Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 49253 invoked from network); 26 May 2005 15:50:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 May 2005 15:50:58 -0000 Received: (qmail 94817 invoked by uid 500); 26 May 2005 15:50:23 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 94806 invoked by uid 500); 26 May 2005 15:50:23 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 94773 invoked by uid 99); 26 May 2005 15:50:23 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from anchor-post-36.mail.demon.net (HELO anchor-post-36.mail.demon.net) (194.217.242.86) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 26 May 2005 08:50:21 -0700 Received: from vitanuova.demon.co.uk ([62.49.21.180] helo=d2) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1DbKcG-0006EN-L3 for tomcat-user@jakarta.apache.org; Thu, 26 May 2005 15:49:50 +0000 From: "Andy" To: "Tomcat Users List" Subject: RE: blank page on invalid form Date: Thu, 26 May 2005 17:00:30 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <000d01c561c5$a550ba70$48c88351@Gurumoorthy> X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Guru and Nikola, Thanks for the suggestions, having looked at this again, I think this is a Struts problem however, so I've posted to struts-users. Thanks anyway, Andy. >-----Original Message----- >From: Gurumoorthy [mailto:g.raghupathy@btinternet.com] >Sent: 26 May 2005 08:37 >To: Tomcat Users List >Subject: Re: blank page on invalid form > > >hello > is wrong > > >Regards >Guru > >----- Original Message ----- >From: "Nikola Milutinovic" >To: "Tomcat Users List" >Sent: Thursday, May 26, 2005 6:04 AM >Subject: Re: blank page on invalid form > > >> Andy wrote: >> >> >Hi All, >> > >> >I'm unable to output any errors using tag, in Tomcat >> >5.5.7 I've tried numerous configurations and have now ran out of >patience. >> >As I haven't been using Struts for more than three days I hope somebody >> >more experienced can point help me out. >> > >> >When I select Submit, entering data into my form fields so the form is >> >parsed as valid, the forward works correctly. When I leave the fields >> >empty, so the form is parsed as invalid, I just get an empty page back - >> >which must be generated by Struts as it doesn't match any HTML I have. >> > >> > >> >> Check out the logs, you could be running into an exception. Also, set >> buffer size of 20kb on all your pages, while you're testing. Empty >> output can also be caused by an exception in the page itself, and buffer >> being already sent. >> >> >Here is what I have in various files - >> > >> >>------------------------------------------------------------------ >--------- >- >> >---- >> > >> >logon.jsp - >> > >> ><%@ page contentType="text/html;charset=UTF-8" language="java" %> >> ><%@ taglib uri="/tags/struts-bean" prefix="bean" %> >> ><%@ taglib uri="/tags/struts-html" prefix="html" %> >> > >> > >> ><bean:message key="logon.title"/> >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> >
Username
Password
>> > >> > >> >
>> >
>> > >> > >> > >> > >> >> Looks fine, except for the buffer page directive. >> >> >In LogonAction.java - >> > >> > >> > public ActionForward execute(ActionMapping mapping, ActionForm form, >> > HttpServletRequest request, >> >HttpServletResponse response) >> > throws Exception { >> > >> > if (isCancelled(request)) { >> > log.debug("cancel pressed"); >> > return mapping.findForward(Constants.FAILURE); >> > } >> > >> > >> >> Why would you consider "Cancel" a failure? Not that it will not work, >but... >> >> > LogonForm logonForm = (LogonForm)form; >> > log.debug("username "+logonForm.getUsername()); >> > log.debug("password "+logonForm.getPassword()); >> > >> > return mapping.findForward(Constants.SUCCESS); >> > } >> > >> > >> >> You're not checking the login, but that's fine for a test. >> >> >In LogonForm.java (I have getters/setters for HTML fields, and a reset >> >method, >> >not shown) - >> > >> > public ActionErrors validate(ActionMapping actionMapping, >> >HttpServletRequest httpServletRequest) { >> > >> > log.debug("validate"); >> > ActionErrors errors = new ActionErrors(); >> > >> > if >> >(FormUtils.isNullOrEmpty(httpServletRequest.getParameter("username"))) { >> > log.debug("logon.form.username.invalid"); >> > errors.add(ActionErrors.GLOBAL_MESSAGE,new >> >ActionMessage("logon.form.username.invalid")); >> > } >> > >> > >> >> You don't need to use GLOBAL_MESSAGE, that is wrong, I think. And use >> errors, not messages. My validation would read: >> >> errors.add( "username", new ActionError( "logon.form.username.invalid")); >> >> Nix. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org