struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <>
Subject RE: Validator validates too early (was RE: Validator won't valida te single required field)
Date Fri, 24 Jan 2003 22:49:35 GMT
David wrote:
> The naming convention in the example app wasn't intuitive for me so I 
> usually do:
> GetAccountFormAction maps to
> SaveAccountFormAction maps to
> There's no "right" way, just the way that makes sense for you.

I had a walk in the Big Blue Room and realized I was making this way too
hard.  I don't need to place a token in the session to tell me that this
isn't the first time the form has been displayed.  There already *is* a
token, in the request, commonly known as the Submit button!

So now I have this:
public final class ChooseProfileForm extends ValidatorForm implements
       public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {
      /*only validate if the form has actually been submitted.
      We can tell this by checking to see if the Submit
      button is in the request
      if (request.getParameter("Submit") != null) {
         return super.validate( mapping, request );
      } else {
        return null;

And all is well again in my world. :)

Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message