我想在jsp中动态加载applicationResources.properties中的值。
ApplicationResource.properties将像这样。
message =无效密码的消息。
我确实喜欢以下代码从jsp的属性文件中检索值。
<fmt:message key="message" var="msgTooltip"/>
<form:password path="password" id="password" showPassword="true" data-toggle="tooltip" data-placement="right" title="${msgTooltip}"/>
以上代码的目的是从属性文件中获取值,并在悬停相应的字段时在工具提示中显示值。
结果,我将在工具提示中获得“无效密码消息”的值。但是我需要将该消息作为“无效密码”得到。
我尝试了一些解决方案,但没有成功,请有人帮助我获得它。
我这样尝试过...
var msgTooltip="<fmt:message key="message"/>";
msgTooltip = msgTooltip.slice(12);
最佳答案
双引号中不能有双引号。我会尝试以下方法:
var msgTooltip='<fmt:message key="message"/>';