How can I translate the incoming data from a database with thymeleaf?

0

I have the following table, and I need the data in the contract_type field to be displayed as pasante or empleado which are saved as intern and employee respectively. thanks in advance.

<th:block th:each="person : ${persons}">
        <tr>
            <td th:text="${person.name}"></td>
            <td th:text="${person.last_name}"></td>
            <td th:text="${person.birth}"></td>
            <td th:text="${person.birth_place}"></td>
            <td th:text="${person.movil_phone}"></td>
            <td th:text="${person.civil_state}"></td>
            <td th:text="${person.nationality}"></td>
            <td th:text="${person.cuil}"></td>
            <td th:text="${person.email}"></td>
            <td th:text="${person.address}"></td>
            <td th:text="${person.address_number}"></td>
            <td th:text="${person.floor}"></td>
            <td th:text="${person.department}"></td>
            <td th:text="${person.contract_type}"></td>//este campo 
            <td th:text="${person.leaveDate}"></td>
        </tr>
    </th:block>
    
asked by Jeypi 10.08.2018 в 17:18
source

1 answer

0

You do not put what criteria you use, so I would use something like this 0 - > Intern 1 - > Employee

<td th:text="${person.contract_type==0?'Pasante' : 'Empleado'}"></td>
    
answered by 10.08.2018 в 17:29