Thymeleaf th:if th:unless

Degiskenler

model.addAttribute("variable", "dogukan");
model.addAttribute("variableBoolean",true);
model.addAttribute("variableBoolean2",false);

 

<div th:if="false" th:text="${variable}"> Test Variable </div>

=Cikti yok

<div th:if="true" th:text="${variable}"> Test Variable </div>

=dogukan

<div th:if="${variableBoolean && variableBoolean2}" th:text="${variable}"> Test Variable </div>

=Cikti yok

<div th:if="${variableBoolean || variableBoolean2}" th:text="${variable}"> Test Variable </div>

=dogukan

<div th:if="${variable == 'dogukan'}" th:text="${variable}"> Test Variable </div>

=dogukan

<div th:if="${variable3 != null}" th:text="${variable}"> Test Variable </div>

=Cikti yok

<div th:if="${variable.charAt(0) == 'd'}" th:text="${variable}"> Test Variable </div>

=Cikti Yok

<div th:if="${variable.charAt(0).toString() == 'd'}" th:text="${variable}"> Test Variable </div>

=dogukan

<div th:unless="false" th:text="${variable}"> Test Variable </div>

=dogukan

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *