You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ancatdubher <an...@gmail.com> on 2008/03/28 14:25:47 UTC
Retaining request attributes after redirect
Hi,
I am building a simple registration module. The user accesses /signup.action
to view signup.jsp. This JSP allows him to enter username, password, phone
and address. When submitted, the /createUser.action is invoked. Validation
of form data also happens here. When form data is invalid, I do a redirect:
<action name="createUser">
<result name="validationFailed" type="action-redirect">signup</result>
</action>
This loses all request attributes.
I can reclaim the error messages by adding the Message Store interceptor.
But I would like to be able to display the Signup.jsp back with all fields
entered by the user. (username, password, phone and address - which are
members of the USER object member on the createUser action)
How do I retain these attributes?
-Thanks, Ancat
--
View this message in context: http://www.nabble.com/Retaining-request-attributes-after-redirect-tp16349672p16349672.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Retaining request attributes after redirect
Posted by st...@gmail.com.
Have you looked at the chain
<http://struts.apache.org/2.0.11.1/docs/chain-result.html>result type?
On Fri, Mar 28, 2008 at 8:25 AM, ancatdubher <an...@gmail.com> wrote:
>
> Hi,
>
> I am building a simple registration module. The user accesses
> /signup.action
> to view signup.jsp. This JSP allows him to enter username, password, phone
> and address. When submitted, the /createUser.action is invoked. Validation
> of form data also happens here. When form data is invalid, I do a
> redirect:
>
> <action name="createUser">
> <result name="validationFailed" type="action-redirect">signup</result>
> </action>
>
> This loses all request attributes.
> I can reclaim the error messages by adding the Message Store interceptor.
> But I would like to be able to display the Signup.jsp back with all fields
> entered by the user. (username, password, phone and address - which are
> members of the USER object member on the createUser action)
> How do I retain these attributes?
>
> -Thanks, Ancat
> --
> View this message in context:
> http://www.nabble.com/Retaining-request-attributes-after-redirect-tp16349672p16349672.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Scott
stanlick@gmail.com
Re: Retaining request attributes after redirect
Posted by Dave Newton <ne...@yahoo.com>.
--- ancatdubher <an...@gmail.com> wrote:
> I am building a simple registration module. The user accesses
> /signup.action
> to view signup.jsp. This JSP allows him to enter username, password, phone
> and address. When submitted, the /createUser.action is invoked. Validation
> of form data also happens here. When form data is invalid, I do a redirect:
>
> <action name="createUser">
> <result name="validationFailed" type="action-redirect">signup</result>
> </action>
>
> This loses all request attributes.
> I can reclaim the error messages by adding the Message Store interceptor.
> But I would like to be able to display the Signup.jsp back with all fields
> entered by the user. (username, password, phone and address - which are
> members of the USER object member on the createUser action)
> How do I retain these attributes?
One option is to create an "input" result for the createUser action, using
the same JSP as the signup action.
> <action name="createUser">
> <result name="input">[[[Same JSP as signup action]]]</result>
> </action>
The validation interceptor will go to this result by default, and if
configured as the default dispatcher result type, there won't be a redirect,
meaning nothing is lost. This also avoids action chaining, which isn't really
necessary for a one-step signup process.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org