I have a Thymeleaf template with this code for pagination
<ul class="results_perpage" >
<li th:if="${previous != null}"><a th:href="javascript:movePage(`${previous}`);" class="results_menu" th:text="PREVIOUS"></a></li>
<li><a href="#" class="results_menu" th:text="${numPage}"></a></li>
<li><a th:href="javascript:movePage(`${next}`);" class="results_menu" th:text="NEXT"></a></li>
</ul>
But I have this error
Could not parse as expression: "javascript:movePage('${previous}');"
I also tried with the grave ascent(`) with the same result
You need to use thymeleaf syntax to add context variables
th:href="'movePage(\'' + ${previous} + '\');'"
Actually I think you should use onClick in place of href.
th:onclick="'movePage(\'' + ${previous} + '\');'"
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.