SEARCH BY

All

  • All
  • Java8
  • Spring

th:href with if else condition in thymeleaf

Post a Comment
In this article we are going to see how to add hyper link to anchor tag based on if else conditions in thymeleaf

th:href="@{'/tasks'+${(type != 'ia')? '/inactiveList' : ''}}" 
In the above snippet of the code the word type is model attribute from rest api, if type is not equal to ia then the link will be /tasks if type is equal to ia then the link with be /tasks/inactiveList
jaya
I love software designing, coding, writing and teaching...

Share this article

Related Posts

Post a Comment

Place your code in <em> </em> tags to send in comments | Do not add hyper links in commnet

Close

Subscribe our newsletter for the latest articles directly into your email inbox