Wednesday, October 18, 2017

Null safe expression in Thymeleaf

Using '?' after the variable in Thymeleaf expression, that variable will be null safe.

<td th:text="${user.department?.name}"></td>
For the avoid example, even variable department is null, the expression will still be fine.

No comments:

Post a Comment

CSP on Apache

To add CSP to root if sort of funny. The following will NOT work for most cases !!     <LocationMatch "^/$">        Header s...