I am currently working on a spring project, and I had to use fmt tags inside my JSPs. In fact fmt tags are working fine for me, and its reading the right value from messages.properties
file.
for example:
<fmt:message key="General.Settings"/>
in the .properties
file:
General.Settings=Settings
it reads it just perfect.
Now, the issue exists when puting the fmt tag inside another JSTL tags.
For example:
<input name="commit" value= <fmt:message key="AllMessages.PostThisMessage"/>
type="submit" onclick="return isEmpty();" />
Inside .properties
file:
AllMessages.PostThisMessage=Post this message
but it displays only the word "Post" instead of "Post this message"
and same with all other fmt tags inside other JSTL tags.
any suggestions?
Don't nest your tags like that, it's confusing and error-prone. Better to do this sort of thing:
<fmt:message key="AllMessages.PostThisMessage" var="myMessage"/>
<input name="commit" value="${myMessage}" type="submit" onclick="return isEmpty();" />
If you really were using this syntax:
value= <fmt:message key="AllMessages.PostThisMessage"/>
Then it's a marvel it worked at all, since that would generate invalid HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With