Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript thymeleaf上的window.location.href_Javascript_Html_Thymeleaf - Fatal编程技术网

Javascript thymeleaf上的window.location.href

Javascript thymeleaf上的window.location.href,javascript,html,thymeleaf,Javascript,Html,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})}'" &g

我的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})} + '\''"