<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:dt="http://www.thymeleaf.org/dandelion/datatables">
<head>
<link href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css" rel="stylesheet" />
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js"></script>
</head>
<body>
   <table id="myTableId" dt:table="true">
      <thead>
         <tr>
            <th>Id</th>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>City</th>
            <th>Mail</th>
         </tr>
      </thead>
      <tbody>
         <tr th:each="person : ${persons}">
            <td th:text="${person.id}">1</td>
            <td th:text="${person.firstName}">John</td>
            <td th:text="${person.lastName}">Doe</td>
            <td th:text="${person.address.town.name}">Nobody knows !</td>
            <td><a th:href="${'mailto:' + person.mail}" th:text="${person.mail}">john@doe.com</a></td>
         </tr>
      </tbody>
   </table>
</body>
</html>
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:dt="http://www.thymeleaf.org/dandelion/datatables">
<head>
<link href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css" rel="stylesheet" />
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js"></script>
</head>
<body>
   <table id="myTableId" dt:table="true">
      <thead>
         <tr>
            <th>Id</th>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>City</th>
            <th>Mail</th>
         </tr>
      </thead>
      <tbody>
         <tr th:each="person : ${persons}">
            <td th:text="${person.id}">1</td>
            <td th:text="${person.firstName}">John</td>
            <td th:text="${person.lastName}">Doe</td>
            <td th:text="${person.address != null and person.address.town != null} ? ${person.address.town.name} : ''">Nobody knows !</td>
            <td><a th:href="${'mailto:' + person.mail}" th:text="${person.mail}">john@doe.com</a></td>
         </tr>
      </tbody>
   </table>
</body>
</html>
Test was not able to pass due to missing protection against null address
Test was not able to pass due to missing protection against null address
