I have this piece of code in my Thymeleaf template but it does not work properly since this is the location generated
deviceevent/@%7B/deviceevent/list/%7Bid%7D(id=$%7BdeviceEvent.id%7D)%7D
in the template
<tr th:each="deviceEvent : ${deviceEvents}" onclick="window.location.href = '@{/deviceevent/list/{id}(id=${deviceEvent.id})}'" >
Thymeleaf doesn't evaluate attributes unless they are prefixed with th
. In this case, th:onclick
. The complete string should look like this:
th:onclick="'window.location.href = \'' + @{/deviceevent/list/{id}(id=${deviceEvent.id})} + '\''"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.