You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by cm132005 <cm...@gmail.com> on 2009/05/08 03:15:10 UTC

Passing a value to JavaScript from a tag

How to pass a value from valueStack to a JavaScript function? 

This doesn't work:
<s:submit value=" Edit " method="edit" onclick='"doEdit(\'<s:property
value="aId"/>\')"' />

Any help would be appreciated.

Thanks.
-- 
View this message in context: http://www.nabble.com/Passing-a-value-to-JavaScript-from-a-tag-tp23438467p23438467.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: Passing a value to JavaScript from a tag

Posted by cm132005 <cm...@gmail.com>.
Thanks, Dave and Suhash. OGNL expression worked fine!


newton.dave wrote:
> 
> cm132005 wrote:
>> How to pass a value from valueStack to a JavaScript function? 
>> 
>> This doesn't work:
>> <s:submit value=" Edit " method="edit" 
>  >           onclick='"doEdit(\'<s:property value="aId"/>\')"' />
> 
> You can't nest custom tags like that; that's not an S2 issue, it's just 
> the way it works. Use OGNL; that's what it's for:
> 
> <s:submit value=" Edit " method="edit" onclick="doEdit('%{aId}')"/>
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Passing-a-value-to-JavaScript-from-a-tag-tp23438467p23456174.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: Passing a value to JavaScript from a tag

Posted by Dave Newton <ne...@yahoo.com>.
cm132005 wrote:
> How to pass a value from valueStack to a JavaScript function? 
> 
> This doesn't work:
> <s:submit value=" Edit " method="edit" 
 >           onclick='"doEdit(\'<s:property value="aId"/>\')"' />

You can't nest custom tags like that; that's not an S2 issue, it's just 
the way it works. Use OGNL; that's what it's for:

<s:submit value=" Edit " method="edit" onclick="doEdit('%{aId}')"/>

Dave


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