gpt4 book ai didi

javascript - 如何在 Spring MVC 中的 javascript 中显示属性文件中的值

转载 作者:行者123 更新时间:2023-11-30 07:29:52 26 4
gpt4 key购买 nike

我正在设置硬编码消息,例如:“您确定要删除该消息吗?” ,在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com