struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Hale Boyes <kcbo...@gmail.com>
Subject Struts 1 - Initialization versus validation
Date Mon, 14 Sep 2009 18:41:57 GMT
I have a setup action defined:

<action path="/setup"
        type="package.SetupAction"
        name="MyForm" validate="false">
    <forward name="success" path="/path/Form.jsp" />
</action>

This action is responsible for setting up values in my (dyna) form
before getting to the JSP page.

I have a second action which is where the JSP will POST to:

<action path="/crud"
        type="package.CrudAction"
        name="MyForm" validate="true" input="/setup">
    <forward name="success" path="/setup"/>
</action>


The idea is that if a validation error occurs then I'll be forwarded
back the setup action
and the page will be displayed again.  On success of the form POST I
will actually
come back to the same page to allow the user to input and POST again.

The validation error could either happen from the (client-side)
validator framework or
it could happen from the CrudAction when it returns to
mapping.getInputForward().

Here's my problem though.  I would like to initialize the form fields
(form.reset()) when
the user first comes to the page or for success navigations but don't
want to reset the
form when coming to the action as a result of an error.

Is there any way to do that?

As noted in the subject, this is on Struts 1 and I'm using struts-validation.

Thanks,
Kevin.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message