Where am I supposed to insert the code that you give? I use the DynaValidatorForm with plug-in by the end of the struts-config.xml file. And I have validation.xml and validator-rules.xml file in the AppName/WEB-INF directory.
Why all my validation warning messages line up? I hope that each warning messages starts at the beginning of a new line? [code] public ActionErrors validate( ActionMapping mapping, HttpServletRequest request ) { ActionErrors ae = new ActionErrors(); /* * only validate if the form has actually been POSTed. * This keeps error messages from appearing when the * form is displayed for the first time. */ if ( request.getMethod().equals( "POST" ) ) { return super.validate( mapping, request ); } else { return null; } } [/code] --- Wendy Smoak <[EMAIL PROTECTED]> wrote: > From: "Caroline Jen" <[EMAIL PROTECTED]> > > I have two problems with the validation messages: > > First, "The first time" that the form is displayed > (a > > blank form), all the validation warning messages > are > > on the top of the web page. > > This comes up repeatedly, please search the > archives. > > You either need to avoid validation the "first" > time, or else turn it off > and call it manually when needed. I leave it turned > on, and do this: > > public ActionErrors validate( ActionMapping > mapping, HttpServletRequest > request ) > { > ActionErrors ae = new ActionErrors(); > /* > * only validate if the form has actually > been POSTed. > * This keeps error messages from appearing > when the > * form is displayed for the first time. > */ > if ( request.getMethod().equals( "POST" ) ) { > return super.validate( mapping, > request ); > } else { > return null; > } > } > > > Can anybody tell what went wrong? Because > validation > > warning messages are supposed to be shown "after" > the > > form is submitted (if there are errors). > > Step through the code in a debugger and it will > become clear. Every time a > request comes in, validate gets called (if you have > it configured that way). > This happens *before* the form gets displayed. > > -- > Wendy Smoak > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]