struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle W. Cartmell" <>
Subject validation breaks my form prepopulation
Date Tue, 02 May 2006 19:57:18 GMT
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 

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

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