开发者

Struts tag in Javascript call

开发者 https://www.devze.com 2023-03-10 14:48 出处:网络
I have a JSP page where I want to say something like: <... onclick=\"alert(\'<bean:message key=\"msg.oops\" />\')\" ... 开发者_StackOverflow中文版/>

I have a JSP page where I want to say something like:

<... onclick="alert('<bean:message key="msg.oops" />')" ... 开发者_StackOverflow中文版/>

This does not work. The page is not rendered. It works fine if I have just:

<... onclick="f('Oops!')" ... />

How should this be done?


Use bean:define to copy the message, then use a JSP expression.

<bean:define id="oops"><bean:message key="msg.oops"></bean:define>
<... onclick="alert('<%= oops %>') ... />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号