Thymeleaf模板取java后台Model里面的值

首先,要在HTML里面使用Thymeleaf模板,要在html引入一下头文件:

<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

然后,再script脚本里面直接如下引用;当然也要加入th标签如下:

<script  th:inline="javascript" type="text/javascript">
    var trackPoints = [[${trackPoints}]] || [[]];
</script>

猜你喜欢

转载自blog.csdn.net/weixin_41704428/article/details/89447023