Quoting learner <[EMAIL PROTECTED]>:
onclick="javascript:return confirm('${message:key_in_my_property_file}');"
i try to use key in javascript like above but failed.
how to use key in javascript?
There are several thing to consider here.
1) You cannot use the message service directly from Javascript, but
you can create Javascript with the message service (the difference is
subtle, but important).
2) I do not know of any ${message: } notation (which Tapestry version
are you using?) I only know the message: prefix binding, which is not
usable here.
3) If you are using this in a template, you must use the ognl: prefix.
Try the following:
<a jwcid="@Any" onclick="ognl:'javascript:return confirm(\'' +
messages.getMessage('key_in_prop') + '\')'">
Or for less confusing string escapes do:
<a jwcid="@Any" onclick="ognl:myLocalizeJavascript">
And in the corresponding class:
---
@Message("key_in_prop")
public String getJsMessage();
public String getMyLocalizedJavascript() {
return String "return confirm('" + getJsMessage() + "')";
}
Regards,
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]