You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kelly.Graus" <Ke...@toltech.net> on 2009/06/25 19:36:37 UTC

Struts2 redirect-action with post params

Hello,

I am trying to redirect to an action when the default index page is
navigated to.  However, I want to include the post params so they are sent
to the action.  Here's what I've got so far:

This is the action that I want to redirect to.  If I call it directly, it
works as expected.
<action name="submitXmlLicenseRequest"
class="net.toltech.webapps.activation.SubmitXmlLicenseRequestAction">
	<interceptor-ref name="sessionScopeDefaultStack" />
	#{ 'licenseRequest' : 'xmlLicenseRequest' }
	<result
name="error">/WEB-INF/jsp/submitXmlLicenseRequest-error.jsp</result>
	<result name="success" type="chain">submitLicenseRequest</result>
</action>

This is the redirect action.  it redirects to the action, but the post
parameter isn't set.
<action name="index" class="com.opensymphony.xwork2.ActionSupport">
	<result name="success"
type="redirect-action">submitXmlLicenseRequest</result>
</action>

Here are a few different ways I've tried to get it to work.  All of these
end up giving me a Premature end of file Fatal Error.
<action name="index" class="com.opensymphony.xwork2.ActionSupport">
	<result name="success"
type="redirect-action">submitXmlLicenseRequest?licenseRequest=${licenseRequest}</result>
</action>

<action name="index" class="com.opensymphony.xwork2.ActionSupport">
	<result name="success"
type="redirect-action">submitXmlLicenseRequest?licenseRequest=${Parameters.licenseRequest}</result>
</action>

<action name="index" class="com.opensymphony.xwork2.ActionSupport">
	<result name="success" type="redirect-action">
		submitXmlLicenseRequest
		${licenseRequest}
	</result>
</action>

<action name="index" class="com.opensymphony.xwork2.ActionSupport">
	<result name="success" type="redirect-action">
		submitXmlLicenseRequest
		${Parameters.licenseRequest}
	</result>
</action>

Thanks for any suggestions!

Kelly
-- 
View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24207810.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: Struts2 redirect-action with post params

Posted by "Kelly.Graus" <Ke...@toltech.net>.
Hi Wes, 

I am using Struts 2.0.11.2.  I tried it using redirectAction, but I am still
receiving the same error.

Kelly

Wes Wannemacher wrote:
> 
> On Thu, Jun 25, 2009 at 1:36 PM, Kelly.Graus
> <Ke...@toltech.net>wrote:
> 
>>
>>
>> This is the redirect action.  it redirects to the action, but the post
>> parameter isn't set.
>> <action name="index" class="com.opensymphony.xwork2.ActionSupport">
>>        <result name="success"
>> type="redirect-action">submitXmlLicenseRequest</result>
>> </action>
>>
>>
> Which version of struts are you using, redirect-action was renamed to
> redirectAction at some point.
> 
> -Wes
> 
> 
> -- 
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24210254.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: Struts2 redirect-action with post params

Posted by Wes Wannemacher <we...@wantii.com>.
On Thu, Jun 25, 2009 at 1:36 PM, Kelly.Graus <Ke...@toltech.net>wrote:

>
>
> This is the redirect action.  it redirects to the action, but the post
> parameter isn't set.
> <action name="index" class="com.opensymphony.xwork2.ActionSupport">
>        <result name="success"
> type="redirect-action">submitXmlLicenseRequest</result>
> </action>
>
>
Which version of struts are you using, redirect-action was renamed to
redirectAction at some point.

-Wes


-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

Re: Struts2 redirect-action with post params

Posted by "Kelly.Graus" <Ke...@toltech.net>.
Hi Brice,

I tried that, I still am receiving a [Fatal Error] Premature end of file
error, and the licenseRequest parameter is not being set.

Any ideas as to why this wouldn't work?

Thanks!

Kelly

brice.roncace wrote:
> 
> Using the named parameter (parameters) that Struts2 places on the OGNL  
> stack should work for you:
> 
> <action name="index" class="com.opensymphony.xwork2.ActionSupport">
> <result type="redirect-action">
> submitXmlLicenseRequest
> ${#parameters.licenseRequest}
> </result>
> </action>
> 
> Brice
> 
-- 
View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24208402.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: Struts2 redirect-action with post params

Posted by br...@gmail.com.
Using the named parameter (parameters) that Struts2 places on the OGNL  
stack should work for you:

<action name="index" class="com.opensymphony.xwork2.ActionSupport">
<result type="redirect-action">
<param name="actionName">submitXmlLicenseRequest</param>
<param name="licenseRequest">${#parameters.licenseRequest}</param>
</result>
</action>

Brice



On Jun 25, 2009 11:36am, "Kelly.Graus" <Ke...@toltech.net> wrote:


> Hello,



> I am trying to redirect to an action when the default index page is

> navigated to. However, I want to include the post params so they are sent

> to the action. Here's what I've got so far:



> This is the action that I want to redirect to. If I call it directly, it

> works as expected.


> class="net.toltech.webapps.activation.SubmitXmlLicenseRequestAction">



> #{ 'licenseRequest' : 'xmlLicenseRequest' }


> name="error">/WEB-INF/jsp/submitXmlLicenseRequest-error.jsp

> submitLicenseRequest





> This is the redirect action. it redirects to the action, but the post

> parameter isn't set.




> type="redirect-action">submitXmlLicenseRequest





> Here are a few different ways I've tried to get it to work. All of these

> end up giving me a Premature end of file Fatal Error.




> type="redirect-action">submitXmlLicenseRequest?licenseRequest=${licenseRequest}








> type="redirect-action">submitXmlLicenseRequest?licenseRequest=${Parameters.licenseRequest}









> submitXmlLicenseRequest

> ${licenseRequest}











> submitXmlLicenseRequest

> ${Parameters.licenseRequest}







> Thanks for any suggestions!



> Kelly

> --

> View this message in context:  
> http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24207810.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