Within my web application (using the Struts action framework) when validation of an ActionForm fails and control is returned to the JSP indicated by struts-config.xml, any request attributes that were passed to that JSP originally are lost because a new request object has been created.

I believe that replacing such request attributes with data members within the ActionForm object and populating them from either the constructor or the reset method resolves this issue and is a much cleaner design.

A problem arises however, in cases where a value is passed from a previous form to assist in the process of populating this data. (For example, a user id number is provided that specifies which user's data should be pulled from the database.)

This may be resolved by setting the value within the ActionForm in the JSP before the populated data would be used, and adding code to the setter method for that value within the ActionForm that acquires that data from the database and stores it within the ActionForm.

There is a question in my mind, however, regarding the correctness of this approach. I have done much research over the past two days, and have seen little in the way of an alternate solution.

Any insight / hyperlinks / good questions would be greatly appreciated!

--
Kyle W. Cartmell
Sr. Software Developer
LAP Holdings, LLC dba First Finance
Phone: (480) 222-0050
Toll Free: (800) 355-3135
[EMAIL PROTECTED]
www.efirstfinance.com

Reply via email to