我正在设置硬编码消息,例如:“您确定要删除该消息吗?” ,在 message.properties 文件中。
想要将此消息从 message.properties 提取到 JavaScript 中。 请建议我实现这一目标的方法。
例如:
BootstrapDialog.show({
message: 'Are you sure you want to '+activeStatus+' this message ?',
title: 'Alert'
});
function handleAjaxError(xhr, textStatus, error) {
if (textStatus == 'timeout') {
alert('The server took too long to send the data.');
} else if (textStatus == "parsererror") {
alert("Ajax error occured.");
}
}
最佳答案
看看 Spring 主题标签:
Retrieves the theme message with the given code, or text if code isn't resolvable. The HTML escaping flag participates in a page-wide or application-wide setting (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml).
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<spring:theme code="code.of.your.message" text="Alternative text"/>
关于javascript - 如何在 Spring MVC 中的 javascript 中显示属性文件中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36309647/