(一)js在thymeleaf H5模板中获取ModelMap
controller层
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
//存入id值
mmap.put("goodsid", id);
return prefix + "/edit";
}
js中获取
<script th:inline="javascript">
var goodsid= [[${goodsid}]];
</script>
(二)js在jsp中获取获取ModelMap
<script>
var goodsid='<%=request.getAttribute("goodsid")%>';
</script>
版权声明:本文为yijian941215原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。