You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marcin Zduniak <ma...@zduniak.com> on 2007/05/01 17:35:36 UTC

Dynamic parameters in struts.xml

Hello everyone,

  I am using Struts2 and I am curious how to pass dynamic parameter
values to an action. I have following XML snippet:

		<action name="otherDeposite"
			class="com.zduniak.web.actions.OtherDepositeAction">
			<result name="back" type="redirect-action">
				<param name="actionName">accountsList</param>
			</result>
			<result name="next" type="redirect-action">
				<param name="actionName">accountsList</param>
				<param name="myParameter">myValue</param>
				<param name="myParameter2">{#myValue}</param>
				<param name="myParameter3">{myValue}</param>
				<param name="myParameter4">%{myValue}</param>
				<param name="myParameter5">${myValue}</param>
				<param name="myParameter6">%{#myValue}</param>
			</result>
			<result name="input">/jsp/otherDeposite.jsp</result>
		</action>

myValue is a getter method in OtherDepositeAction action class.
Unfortunately none of these expressions are properly exchanged into
value from myValue property.

Is there any solution to passing dynamic parameters while redirecting
to another action ?

Thank you and kind regards,

-- 
Marcin Zduniak                    marcin@zduniak.com
+ 48 600 27 88 66             http://www.zduniak.com

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


Re: Dynamic parameters in struts.xml

Posted by Marcin Zduniak <ma...@zduniak.com>.
Thank you. I actually solved the problem. When I added another one parameter:

<param name="parse">true</param>

myParameter5 started working.

Thanks.

Marcin

On 5/2/07, Laurie Harper <la...@holoweb.net> wrote:
> Marcin Zduniak wrote:
> > Hello everyone,
> >
> >  I am using Struts2 and I am curious how to pass dynamic parameter
> > values to an action. I have following XML snippet:
> >
> >         <action name="otherDeposite"
> >             class="com.zduniak.web.actions.OtherDepositeAction">
> >             <result name="back" type="redirect-action">
> >                 <param name="actionName">accountsList</param>
> >             </result>
> >             <result name="next" type="redirect-action">
> >                 <param name="actionName">accountsList</param>
> >                 <param name="myParameter">myValue</param>
> >                 <param name="myParameter2">{#myValue}</param>
> >                 <param name="myParameter3">{myValue}</param>
> >                 <param name="myParameter4">%{myValue}</param>
> >                 <param name="myParameter5">${myValue}</param>
> >                 <param name="myParameter6">%{#myValue}</param>
> >             </result>
> >             <result name="input">/jsp/otherDeposite.jsp</result>
> >         </action>
> >
> > myValue is a getter method in OtherDepositeAction action class.
> > Unfortunately none of these expressions are properly exchanged into
> > value from myValue property.
> >
> > Is there any solution to passing dynamic parameters while redirecting
> > to another action ?
>
> I believe the parameters should become part of the query string for the
> redirect, which should work. The correct form is what you have for
> myParameter5, i.e. the '${myValue}' form.
>
> Are you sure your getter is correctly specified and returning a
> non-null, non-empty value? Is the action definitely returning a result
> of 'next'? What happens if you don't use a redirect?
>
> L.

-- 
Marcin Zduniak                    marcin@zduniak.com
+ 48 600 27 88 66             http://www.zduniak.com

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


Re: Dynamic parameters in struts.xml

Posted by Laurie Harper <la...@holoweb.net>.
Marcin Zduniak wrote:
> Hello everyone,
> 
>  I am using Struts2 and I am curious how to pass dynamic parameter
> values to an action. I have following XML snippet:
> 
>         <action name="otherDeposite"
>             class="com.zduniak.web.actions.OtherDepositeAction">
>             <result name="back" type="redirect-action">
>                 <param name="actionName">accountsList</param>
>             </result>
>             <result name="next" type="redirect-action">
>                 <param name="actionName">accountsList</param>
>                 <param name="myParameter">myValue</param>
>                 <param name="myParameter2">{#myValue}</param>
>                 <param name="myParameter3">{myValue}</param>
>                 <param name="myParameter4">%{myValue}</param>
>                 <param name="myParameter5">${myValue}</param>
>                 <param name="myParameter6">%{#myValue}</param>
>             </result>
>             <result name="input">/jsp/otherDeposite.jsp</result>
>         </action>
> 
> myValue is a getter method in OtherDepositeAction action class.
> Unfortunately none of these expressions are properly exchanged into
> value from myValue property.
> 
> Is there any solution to passing dynamic parameters while redirecting
> to another action ?

I believe the parameters should become part of the query string for the 
redirect, which should work. The correct form is what you have for 
myParameter5, i.e. the '${myValue}' form.

Are you sure your getter is correctly specified and returning a 
non-null, non-empty value? Is the action definitely returning a result 
of 'next'? What happens if you don't use a redirect?

L.


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