When working with multipage forms it is desirable to have one bean in the
users session that is populated as the user goes through the various pages
of the form. 

I mistakenly thought that this was one of the services that struts provides.
I have now discovered that this is not the case. When a form is submitted
Struts seems to blindly replace the previous bean with a new one and then
populates the new one with only the values that are on that particular form.
(Is there something I am missing?) The only way I can get it to work is to
put hidden fields in the form so that the data entered on one page is
populate back into the bean again when it is submitted. The only other
option I see is to have a single bean for each page, but this is not a
desirable solution. Is there some other solution? Perhaps by storing the new
bean in the request instead of the session, and then copying the values into
the session bean? This seems like a big pain too!

Adding hidden fields to each form means that one either has to put all of
the fields of the bean into every form (which is a big headache if you want
to add a field) or you have to put all the fields in that have been entered
so far (which is a big headache if you want to change the flow of the
pages.) 

It seems to me that the population of values into a bean should be proceeded
by a check to see if there is a bean in the users session. If there is then
that beans set methods should be called. This would make it so much easier
to create multiage forms, and would not require the user to add all the
hidden fields to a form. This is what I thought struts did when I started
using it, and I am disappointed that this is not the case.

-Nick

Reply via email to