You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Liptak <na...@biwabik.net> on 2009/03/18 04:24:37 UTC

redirect parameters lost when using convention plugin 2.1.6

I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6.

I've been following the instructions at 
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestruts.xmlConfiguration
converting from 2.0 to 2.1 . 

Since we are currently using the zero config plugin, I'm also looking at the
convention plugin 
http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsandresultcodes
here .

The issue I'm having is that parameters that are set on the redirect are
lost.  I'm getting the OGNL exception that the trouble shooting guide says
I'm supposed to get, but then the parameters are not sent as part of the
redirect.

Things that might be causing issues:
1.) I've kept the naming of the original URLs using @Action annotations
2.) I've set the action extention to only be "action" and not "action,"
3.) I'm using Weblogic 10.2

I've tried all of the different ways I know to do a redirect:
1.) Class level using params
    @Result(name = "redirect", location = "pingDestination.action", type =
"redirect",
    params = { "aParam", "a parameter" } )
2.) Class level using location
     @Result(name = "redirect2", location =
"/test/pingDestination.action?aParam=${message}", type = "redirect" )
3.) Action level
   @Action(value = "/test/pingRedirect3", 
            results={@Result(name = "redirect", location =
"pingDestination.action", type = "redirect",
            params = { "parse" , "true", "aParam", "a parameter" } )},
            params = { "parse" , "true", "aParam", "another parameter" })
    public String executeRedirect3() throws Exception {...
4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config
loading and WebLogic don't like each other.

Any ideas?

Here is my struts.xml
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
	<constant name="struts.devMode" value="false" />
    <constant name="struts.objectFactory"
value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    <constant name="struts.action.extension" value="action" />
    <constant name="struts.convention.result.path" value="/" />
    <constant name="struts.convention.package.locators"
value="action,actions,struts,struts2,view" />

	<package name="qcadmin" extends="struts-default">

		<global-exception-mappings>
            <exception-mapping exception="java.lang.Exception"
result="error"/>
            <exception-mapping exception="java.rmi.RemoteException"
result="error"/>
            <exception-mapping exception="javax.xml.rpc.ServiceException"
result="error"/>
            <exception-mapping exception="org.apache.xmlbeans.XmlException"
result="error"/>
        </global-exception-mappings>
       
       <action name="ExceptionHandle">
			<result name="error" type="chain">/WEB-INF/common/Error.jsp</result>
       </action>
	</package>
	
	<package name="mfw" extends="qcadmin" namespace="/qcadmin/mfw">
	
		<default-interceptor-ref name="paramsPrepareParamsStack"/>
		
	</package>
</struts>
-- 
View this message in context: http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-2.1.6-tp22572248p22572248.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: redirect parameters lost when using convention plugin 2.1.6

Posted by John Liptak <bi...@atdenver.com>.
Great.  That fixed my problem.  I also had a typo in one of my other
attempts and this explains what happened.

-----Original Message-----
From: Musachy Barroso [mailto:musachy@gmail.com] 
Sent: Wednesday, March 18, 2009 7:42 AM
To: Struts Users Mailing List
Subject: Re: redirect parameters lost when using convention plugin 2.1.6

The problem is that "redirect" does not not use "params", only
"redirect-action" does. So to use redirect, you need to do something
like(or set "location" in the annotation):

<result type="redirect">/someurl.action?myparam=%{somevalue}</result>

and yeah, the documentation is wrong, and this is not consistent. I
will update redirect to be similar to redirect-action.

musachy

On Tue, Mar 17, 2009 at 11:24 PM, John Liptak <na...@biwabik.net> wrote:
>
> I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6.
>
> I've been following the instructions at
>
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-2
0x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestr
uts.xmlConfiguration
> converting from 2.0 to 2.1 .
>
> Since we are currently using the zero config plugin, I'm also looking at
the
> convention plugin
>
http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsan
dresultcodes
> here .
>
> The issue I'm having is that parameters that are set on the redirect are
> lost.  I'm getting the OGNL exception that the trouble shooting guide says
> I'm supposed to get, but then the parameters are not sent as part of the
> redirect.
>
> Things that might be causing issues:
> 1.) I've kept the naming of the original URLs using @Action annotations
> 2.) I've set the action extention to only be "action" and not "action,"
> 3.) I'm using Weblogic 10.2
>
> I've tried all of the different ways I know to do a redirect:
> 1.) Class level using params
>    @Result(name = "redirect", location = "pingDestination.action", type =
> "redirect",
>    params = { "aParam", "a parameter" } )
> 2.) Class level using location
>     @Result(name = "redirect2", location =
> "/test/pingDestination.action?aParam=${message}", type = "redirect" )
> 3.) Action level
>   @Action(value = "/test/pingRedirect3",
>            results={@Result(name = "redirect", location =
> "pingDestination.action", type = "redirect",
>            params = { "parse" , "true", "aParam", "a parameter" } )},
>            params = { "parse" , "true", "aParam", "another parameter" })
>    public String executeRedirect3() throws Exception {...
> 4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config
> loading and WebLogic don't like each other.
>
> Any ideas?
>
> Here is my struts.xml
> <!DOCTYPE struts PUBLIC
>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>    "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
>        <constant name="struts.devMode" value="false" />
>    <constant name="struts.objectFactory"
> value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
>    <constant name="struts.action.extension" value="action" />
>    <constant name="struts.convention.result.path" value="/" />
>    <constant name="struts.convention.package.locators"
> value="action,actions,struts,struts2,view" />
>
>        <package name="qcadmin" extends="struts-default">
>
>                <global-exception-mappings>
>            <exception-mapping exception="java.lang.Exception"
> result="error"/>
>            <exception-mapping exception="java.rmi.RemoteException"
> result="error"/>
>            <exception-mapping exception="javax.xml.rpc.ServiceException"
> result="error"/>
>            <exception-mapping exception="org.apache.xmlbeans.XmlException"
> result="error"/>
>        </global-exception-mappings>
>
>       <action name="ExceptionHandle">
>                        <result name="error"
type="chain">/WEB-INF/common/Error.jsp</result>
>       </action>
>        </package>
>
>        <package name="mfw" extends="qcadmin" namespace="/qcadmin/mfw">
>
>                <default-interceptor-ref name="paramsPrepareParamsStack"/>
>
>        </package>
> </struts>
> --
> View this message in context:
http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-
2.1.6-tp22572248p22572248.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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd



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


Re: redirect parameters lost when using convention plugin 2.1.6

Posted by Musachy Barroso <mu...@gmail.com>.
Fixed in trunk. Jira ticket: https://issues.apache.org/struts/browse/WW-3046

thanks for reporting
musachy

On Wed, Mar 18, 2009 at 9:42 AM, Musachy Barroso <mu...@gmail.com> wrote:
> The problem is that "redirect" does not not use "params", only
> "redirect-action" does. So to use redirect, you need to do something
> like(or set "location" in the annotation):
>
> <result type="redirect">/someurl.action?myparam=%{somevalue}</result>
>
> and yeah, the documentation is wrong, and this is not consistent. I
> will update redirect to be similar to redirect-action.
>
> musachy
>
> On Tue, Mar 17, 2009 at 11:24 PM, John Liptak <na...@biwabik.net> wrote:
>>
>> I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6.
>>
>> I've been following the instructions at
>> http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestruts.xmlConfiguration
>> converting from 2.0 to 2.1 .
>>
>> Since we are currently using the zero config plugin, I'm also looking at the
>> convention plugin
>> http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsandresultcodes
>> here .
>>
>> The issue I'm having is that parameters that are set on the redirect are
>> lost.  I'm getting the OGNL exception that the trouble shooting guide says
>> I'm supposed to get, but then the parameters are not sent as part of the
>> redirect.
>>
>> Things that might be causing issues:
>> 1.) I've kept the naming of the original URLs using @Action annotations
>> 2.) I've set the action extention to only be "action" and not "action,"
>> 3.) I'm using Weblogic 10.2
>>
>> I've tried all of the different ways I know to do a redirect:
>> 1.) Class level using params
>>    @Result(name = "redirect", location = "pingDestination.action", type =
>> "redirect",
>>    params = { "aParam", "a parameter" } )
>> 2.) Class level using location
>>     @Result(name = "redirect2", location =
>> "/test/pingDestination.action?aParam=${message}", type = "redirect" )
>> 3.) Action level
>>   @Action(value = "/test/pingRedirect3",
>>            results={@Result(name = "redirect", location =
>> "pingDestination.action", type = "redirect",
>>            params = { "parse" , "true", "aParam", "a parameter" } )},
>>            params = { "parse" , "true", "aParam", "another parameter" })
>>    public String executeRedirect3() throws Exception {...
>> 4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config
>> loading and WebLogic don't like each other.
>>
>> Any ideas?
>>
>> Here is my struts.xml
>> <!DOCTYPE struts PUBLIC
>>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>>    "http://struts.apache.org/dtds/struts-2.0.dtd">
>> <struts>
>>        <constant name="struts.devMode" value="false" />
>>    <constant name="struts.objectFactory"
>> value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
>>    <constant name="struts.action.extension" value="action" />
>>    <constant name="struts.convention.result.path" value="/" />
>>    <constant name="struts.convention.package.locators"
>> value="action,actions,struts,struts2,view" />
>>
>>        <package name="qcadmin" extends="struts-default">
>>
>>                <global-exception-mappings>
>>            <exception-mapping exception="java.lang.Exception"
>> result="error"/>
>>            <exception-mapping exception="java.rmi.RemoteException"
>> result="error"/>
>>            <exception-mapping exception="javax.xml.rpc.ServiceException"
>> result="error"/>
>>            <exception-mapping exception="org.apache.xmlbeans.XmlException"
>> result="error"/>
>>        </global-exception-mappings>
>>
>>       <action name="ExceptionHandle">
>>                        <result name="error" type="chain">/WEB-INF/common/Error.jsp</result>
>>       </action>
>>        </package>
>>
>>        <package name="mfw" extends="qcadmin" namespace="/qcadmin/mfw">
>>
>>                <default-interceptor-ref name="paramsPrepareParamsStack"/>
>>
>>        </package>
>> </struts>
>> --
>> View this message in context: http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-2.1.6-tp22572248p22572248.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
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: redirect parameters lost when using convention plugin 2.1.6

Posted by Musachy Barroso <mu...@gmail.com>.
The problem is that "redirect" does not not use "params", only
"redirect-action" does. So to use redirect, you need to do something
like(or set "location" in the annotation):

<result type="redirect">/someurl.action?myparam=%{somevalue}</result>

and yeah, the documentation is wrong, and this is not consistent. I
will update redirect to be similar to redirect-action.

musachy

On Tue, Mar 17, 2009 at 11:24 PM, John Liptak <na...@biwabik.net> wrote:
>
> I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6.
>
> I've been following the instructions at
> http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestruts.xmlConfiguration
> converting from 2.0 to 2.1 .
>
> Since we are currently using the zero config plugin, I'm also looking at the
> convention plugin
> http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsandresultcodes
> here .
>
> The issue I'm having is that parameters that are set on the redirect are
> lost.  I'm getting the OGNL exception that the trouble shooting guide says
> I'm supposed to get, but then the parameters are not sent as part of the
> redirect.
>
> Things that might be causing issues:
> 1.) I've kept the naming of the original URLs using @Action annotations
> 2.) I've set the action extention to only be "action" and not "action,"
> 3.) I'm using Weblogic 10.2
>
> I've tried all of the different ways I know to do a redirect:
> 1.) Class level using params
>    @Result(name = "redirect", location = "pingDestination.action", type =
> "redirect",
>    params = { "aParam", "a parameter" } )
> 2.) Class level using location
>     @Result(name = "redirect2", location =
> "/test/pingDestination.action?aParam=${message}", type = "redirect" )
> 3.) Action level
>   @Action(value = "/test/pingRedirect3",
>            results={@Result(name = "redirect", location =
> "pingDestination.action", type = "redirect",
>            params = { "parse" , "true", "aParam", "a parameter" } )},
>            params = { "parse" , "true", "aParam", "another parameter" })
>    public String executeRedirect3() throws Exception {...
> 4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config
> loading and WebLogic don't like each other.
>
> Any ideas?
>
> Here is my struts.xml
> <!DOCTYPE struts PUBLIC
>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>    "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
>        <constant name="struts.devMode" value="false" />
>    <constant name="struts.objectFactory"
> value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
>    <constant name="struts.action.extension" value="action" />
>    <constant name="struts.convention.result.path" value="/" />
>    <constant name="struts.convention.package.locators"
> value="action,actions,struts,struts2,view" />
>
>        <package name="qcadmin" extends="struts-default">
>
>                <global-exception-mappings>
>            <exception-mapping exception="java.lang.Exception"
> result="error"/>
>            <exception-mapping exception="java.rmi.RemoteException"
> result="error"/>
>            <exception-mapping exception="javax.xml.rpc.ServiceException"
> result="error"/>
>            <exception-mapping exception="org.apache.xmlbeans.XmlException"
> result="error"/>
>        </global-exception-mappings>
>
>       <action name="ExceptionHandle">
>                        <result name="error" type="chain">/WEB-INF/common/Error.jsp</result>
>       </action>
>        </package>
>
>        <package name="mfw" extends="qcadmin" namespace="/qcadmin/mfw">
>
>                <default-interceptor-ref name="paramsPrepareParamsStack"/>
>
>        </package>
> </struts>
> --
> View this message in context: http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-2.1.6-tp22572248p22572248.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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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