![](/img/trans.png)
[英]window.location.href = window.location.href and JSLint
[英]window.location.href on thymeleaf
我在Thymeleaf模板中有这段代码,但它不能正常工作,因为这是生成的位置
deviceevent/@%7B/deviceevent/list/%7Bid%7D(id=$%7BdeviceEvent.id%7D)%7D
在模板中
<tr th:each="deviceEvent : ${deviceEvents}" onclick="window.location.href = '@{/deviceevent/list/{id}(id=${deviceEvent.id})}'" >
Thymeleaf不会评估属性,除非它们以th
为前缀。 在这种情况下, th:onclick
。 完整的字符串应如下所示:
th:onclick="'window.location.href = \'' + @{/deviceevent/list/{id}(id=${deviceEvent.id})} + '\''"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.