我不知道如何解决这个问题
Spring-side:role.java
@RequestMapping(value = "/role", method = RequestMethod.GET)
public String role(Model model){
List<Role> list=rImp.list();
model.addAttribute("data",list);
return "role";
}
所以如果我现在尝试inline =&#34; javascript&#34;:
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
var List = /*[[${data}]]*/;
/*]]>*/
</script>
当我运行它时,我得到了这样的回复:
Whitelabel错误页面
This application has no explicit mapping for /error, so you are seeing this as a fallback. Sun Jun 11 05:00:35 WET 2017 There was an unexpected error (type=Internal Server Error, status=500). No message available
答案 0 :(得分:0)
请使用/*<![CDATA[*/var List = /*[[${data}]]*/;/*]]>*/
代替var List = [[${list}]];
,因为该列表已添加到具有此名称的模型中。