1

I'm new for thymeleaf.

The question is easy when it's in jsp. But it beats me in thymeleaf.

I want to complete this function as below:

if (page.number<=1) html like this: <li class="q-pagination-disabled">Pre</li> else <li><a href="/pages/{page.number-1}">Pre</a></li> 

But I can't finish it with th:if,th:href,th:remove and so on. Does anyone know how to do it?

1 Answer 1

2

Try the following and let me know if it worked for you

<li th:if="${page.number le 1}" class="q-pagination-disabled">Pre</li> <li th:if="${page.number gt 1}"><a th:href="@{/pages/{page}(page=${page.number-1})}">Pre</a></li> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.