![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Thymeleaf
沐白的微笑
这个作者很懒,什么都没留下…
展开
-
Thymeleaf模板,在HTML的JavaScript 中使用变量
在HTML中将从后端传过来的数据使用在js脚本中,需要进行如下配置:<script th:inline="javascript"> var fs1 = [[${fs1}]]; console.log(fs1); var user = /*[[${user}]]*/ null; console.log(user)</script>Thymeleaf会自动将变量进行转换,同时将对象转换成json串,如上面的user对象,控制台打印出来的内容原创 2020-06-18 15:27:44 · 2982 阅读 · 0 评论 -
Thymeleaf 使用国际化配置
在springboot中与Thymeleaf进行整合时,进行国际化的支持。配置好Thymeleaf依赖后,在resources目录中创建文件夹:然后在springboot的配置文件中配置属性项:spring.messages.basename=i18n/home然后在各个properties文件中写入内容:home.welcome= 欢迎来到我的首页最后在HTML页面中:<a th:text="#{home.welcome}">hello</a>原创 2020-06-18 14:52:11 · 332 阅读 · 0 评论