Bill Siggelkow wrote:
I would concur with Ted -- I have worked with Struts apps that take approach (B) -- that is, using the business object as the Form -- not only does this bind your business object to the Struts API -- more importantly, you have to make sure that all the field types are strings or booleans. If not, Struts will not be able to populate the form when bad data is sent -- the dreaded *BeanUtils.populate* error! So, if you have to make all your fields be strings and booleans, now you are letting presentation drive the spec for your business objects!
But see isn't that all a limitation of Struts and its validation framework? This is my major complaint I have with Struts - the requirment to create ActionForms simply so validation can work properly. I think a much cleaner approach would be to bind a "valdiation" to your action-mapping and then the RequestProcessor would be able to interpret the request and validate the request parameters correctly before trying to populate your backing object (POJO). I haven't really used the Spring framework, but I believe it behaves in some similar way - where the framework takes care of validation of the request parameters (not of an ActionForm).
I think Struts ties your hands too much forcing reliance on the use of ActionForms for everything. For your typical simple JSP form, ActionForms are not that big of a deal (although I still find them a bit annoying), but it really falls apart when you have to create some complex forms where you have a lot of nested objects. It's incredibly annoying trying to convert all the nested objects, sometimes in our case, three or four deep, into nested ActionForms. You're probably going "ughh" what kind of form is that:) but business requirments dictate we need it since we're stuck with the initial objects coming back as VOs.
-- Rick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]