“thymeleaf th: si exemple” Réponses codées

thymeleaf th: si exemple

<td>
    <span th:if="${teacher.gender == 'F'}">Female</span>
    <span th:unless="${teacher.gender == 'F'}">Male</span>
</td>
Tame Tortoise

thymeleaf th: si exemple

<td th:text="${teacher.active} ? 'ACTIVE' : 'RETIRED'" />
Balaji Rengan

thymeleaf th: si exemple

public class Teacher implements Serializable {
    private String gender;
    private boolean isActive;
    private List<String> courses = new ArrayList<>();
    private String additionalSkills;
Balaji Rengan

thymeleaf th: si exemple

<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf</artifactId>
    <version>3.0.11.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-spring5</artifactId>
    <version>3.0.11.RELEASE</version>
</dependency>
Balaji Rengan

thymeleaf th: si exemple

<td th:text="${teacher.additionalSkills} ?: 'UNKNOWN'" />
Balaji Rengan

thymeleaf th: si exemple

<td th:switch="${#lists.size(teacher.courses)}">
    <span th:case="'0'">NO COURSES YET!</span>
    <span th:case="'1'" th:text="${teacher.courses[0]}"></span>
    <div th:case="*">
        <div th:each="course:${teacher.courses}" th:text="${course}"/>
    </div>
</td>
Balaji Rengan

Réponses similaires à “thymeleaf th: si exemple”

Questions similaires à “thymeleaf th: si exemple”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code