gpt4 book ai didi

java - Thymeleaf 、 JQuery 和消息属性

转载 作者:行者123 更新时间:2023-11-30 02:32:44 25 4
gpt4 key购买 nike

我有一个基本的 SpringBoot 应用程序。使用 Spring Initializer、嵌入式 Tomcat、Thymeleaf 模板引擎,并打包为可执行 JAR 文件。

我的 message.properties 中有此消息

resetPassword.sending.email=Sending email

我想在 HTML 中使用它,

$("#sendEmailButtonId").click(function(e) {
$("#emailLabelId").text([[#{resetPassword.sending.email}]]);
});

但它不会替换文本

最佳答案

添加<script th:inline="javascript">在 thymeleaf 周围的脚本 block 中解析 [[${...}]]表达式。

关于java - Thymeleaf 、 JQuery 和消息属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43855272/

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