You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Thielen <da...@windward.net> on 2003/08/13 05:05:37 UTC
action forward -> redirect
Hi;
I have action forwards in my action mapping as such:
<action-mappings>
<action path="/OrderSubmit"
type="net.windward.store.OrderAction"
name="orderForm"
validate="true"
input="/order.jsp">
<forward name="success" path="/terms.jsp"/>
<forward name="failure" path="/order.jsp"/>
</action>
</action-mappings>
So on a success it forwards to /terms.jsp. However, the browser url is still OrderSubmit.do. This is what a forward is supposed to do.
But what if I want the browser to now show /terms.jsp? Is there some way to do an action redirect without another jsp to have a redirect in it?
Also, for a multi-page form - do I want each page to have a different url in the browser? Or just one that runs everything? Life is easier from a programming point of view if each page has it's own action and form.
thanks - dave
Re: action forward -> redirect
Posted by Max Cooper <ma...@maxcooper.com>.
Use this:
<action-mappings>
<action path="/OrderSubmit"
type="net.windward.store.OrderAction"
name="orderForm"
validate="true"
input="/order.jsp">
<forward name="success" path="/terms.jsp" redirect="true"/>
<forward name="failure" path="/order.jsp"/>
</action>
</action-mappings>
But keep in mind that it will be a separate request at that point, so
anything that your OrderAction puts into the request will not be there after
the redirect. You can always setup another action to redirect to, that will
prepare items in the request before the eventual forward to /terms.jsp.
<action-mappings>
<action path="/OrderSubmit"
type="net.windward.store.OrderAction"
name="orderForm"
validate="true"
input="/order.jsp">
<forward name="success" path="/ShowTerms.do" redirect="true"/>
<forward name="failure" path="/order.jsp"/>
</action>
<action path="/ShowTerms"
type="net.windward.store.ShowTermsAction">
<forward name="success" path="/terms.jsp"/>
</action>
</action-mappings>
-Max
----- Original Message -----
From: "David Thielen" <da...@windward.net>
To: "Struts-Users" <st...@jakarta.apache.org>
Sent: Tuesday, August 12, 2003 8:05 PM
Subject: action forward -> redirect
Hi;
I have action forwards in my action mapping as such:
<action-mappings>
<action path="/OrderSubmit"
type="net.windward.store.OrderAction"
name="orderForm"
validate="true"
input="/order.jsp">
<forward name="success" path="/terms.jsp"/>
<forward name="failure" path="/order.jsp"/>
</action>
</action-mappings>
So on a success it forwards to /terms.jsp. However, the browser url is still
OrderSubmit.do. This is what a forward is supposed to do.
But what if I want the browser to now show /terms.jsp? Is there some way to
do an action redirect without another jsp to have a redirect in it?
Also, for a multi-page form - do I want each page to have a different url in
the browser? Or just one that runs everything? Life is easier from a
programming point of view if each page has it's own action and form.
thanks - dave
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org