Reputation: 2746
I have a JSP page where I want to say something like:
<... onclick="alert('<bean:message key="msg.oops" />')" ... />
This does not work. The page is not rendered. It works fine if I have just:
<... onclick="f('Oops!')" ... />
How should this be done?
Upvotes: 0
Views: 1239
Reputation: 2746
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 %>') ... />
Upvotes: 1