You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Serge Bornow <se...@architech-solutions.com> on 2008/02/26 21:27:28 UTC

Set an Action variable at runtime

Hello All,

Thanks for any ideas.
My Action class has a get/set homeid

How can i invoke from JSP to set the value of that variable to a dynamic 
value

A suggestion was this:
<s:property value="foo('huh? ')"/>

But i need to pass a variable and property tag doesnt allow expression.
Any work arounds.

I spent 5 hours trying all kinds of things, please help.
Thank you,


Serge

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


Re: Set an Action variable at runtime

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Serge Bornow wrote:
> Hello All,
>
> Thanks for any ideas.
> My Action class has a get/set homeid
>
> How can i invoke from JSP to set the value of that variable to a 
> dynamic value
I'm not quite sure what you're trying to do.  If you're just try to set 
a property at the time of posting to your action then just use an input 
in a form.
If you mean you need to change a value while rendering the JSP than all 
you probably need is to define a variable in PageContext
If you're trying to update the state of an action while rendering the 
JSP, that doesn't sound very sensible, but you can make a method call 
described below. 
>
> A suggestion was this:
> <s:property value="foo('huh? ')"/>
>
This is valid code in Struts2.  That will get the result of calling the 
method foo with parameter "huh? ". 
ie. it will call foo(String) not getFoo(String)
OGNL can call methods.




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