struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Re: Multiple ActionForms per ActionMapping
Date Fri, 18 Mar 2005 16:09:36 GMT
Frank W. Zammetti wrote the following on 3/18/2005 10:42 AM:

> I'm not a believer in auto-generated code under any circumstance, even
> something as clearly mundane as getters and setters. 

Ok, not going down that road..<cough>wacko</cough>:) But seriously 
though, you said you had about 2000 lines of code between your 
ActionForms. How much time do you think it takes you type out all those 
getters and setters for all those properties? No way, you can tell me 
that autogeneration of those set/get methods wouldn't save you time and 
we all know time==money. But I know, there won't be any convincing you 

>>Actually you can validate on an action mapping basis and not on the form
>>name, so only the fields you are interested in for the action mapping
>>get checked.
> Can you explain that?  Are you talking about using declarative validation?
> That is something I haven't used yet, but yes, I can see where that would
> remove the point I made.

"An alternative approach is to use the action mapping path attribute. In 
this case, you extend the ValidatorActionForm instead of the 
ValidatorForm. The ValidatorActionForm uses the action element's path 
attribute from the Struts configuration which should match the form 
element's name attribute in the Validator configuration.

Then a separate action mapping can be defined for each page in a 
multi-page form, and the validation form can be associated with the 
action rather than a page number (as shown in the example of a 
multi-page form in the validator example)."

> Certainly you would agree that if you choose to do validations in
> validate(), you would have the problem I mentioned, right?  Or is there
> something here for me to learn? :)

Well, actually I like to have my own validate() method in each of my 
Dispatch Actions. I don't like having the framework call validate for 
me. One of the main reason is that if I'm in my action and I manually 
call my own action's validate() method then, if validation fails, I can 
make sure my prep method is always called. I wrote about this here and at the end I 
give an example of what I like to do. (I'm curious, in that approach you 
came up with, if validation were to fail, would the extra 'setup' that 
you added to the action mapping be called? If so, that would be very 
nice! if not then I'd still end up having to use my prep/set up method).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message