You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Harrison <go...@alumni.princeton.edu> on 2003/07/08 03:44:15 UTC
Re-populating form page options after validation failure
My problem bears some resemblance to one dicussed here in January, when
Brandon Goodin posted about collection population when using the
validator. (I read it in the archive).
Following Rick Reumann's Struts tutorials
(http://www.reumann.net/do/struts/main), I have built a three-step
registration process with Struts. In the forms that make up steps two
and three, there are several selects and checkbox groups in which the
values and labels are dynamically-generated, as in Reumann's tutorial. I
have followed his design by coding SetUpFooForm Actions for steps two
and three: these generate the values and labels and stick them as bean
collections in the request scope for the form JSP to use. Then, upon
form submission, a FooAction Action handles the submission, and the next
SetUpFooForm Action is executed. So far so good.
However, now that I've added the Validator, I have a problem when step
two fails validation: I can't point the failure forward to the JSP,
since there are no values in the request for the form. I tried <forward
name="failure" path="/SetUpFooForm.do" /> to get the setup action to
run again and set up the necessary collections in the request. This,
however, didn't seem to change anything: I still get errors from my
Servlet container telling me it can't find the bean collections. In
facct, from monitoring catalina.out, it doesn't even look like
SetUpFooForm is running when the form validation fails. Is it illegal to
point the failure forward to a setup class?
I suppose I could put the collections in the session, as some folks
suggested to Brandon, but I'd much rather keep the system's memory free:
there are a dozen collections, and they might be present for some time
as the users complete the registration. Shouldn't my solution work?
Thanks,
Michael Harrison
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org