Thymeleaf 遇到的问题

1. 后台传递long类型的值作为 js 执行方法的参数,精准度失效解决办法

解决办法:用thymeleaf的拼接字符串方法来解决

例:
<button class="btn btn-primary" th:value="${user.userName}" id="edit" type="button" th:onclick="'javascript:edit('+'\''+${user.userId}+'\''+')'">修改</button>
function edit(id){
location.href = contextPath +'/user/'+id;
}
posted @ 2018-12-07 11:45  稳不住  阅读(310)  评论(0编辑  收藏  举报