1

for my web app (spring boot + thymeleaf) i use message_fr.properties file witch contains some special characters converted to html the problem comes when i display the error validation message in lang=fr :

<span th:if="${#fields.hasErrors('title')}" th:errors="*{title}"></span>

assume that key/value are : NotEmpty.item.title = Ne doit pas &ecirc;tre null on screen it displays the error message without conversion : Ne doit pas &ecirc;tre null

how can i resolve it ?

1 Answer 1

2

th:errors will escape HTML in the same way that th:text does. Before 3.0.8, you would have to iterate over the errors like this:

<span th:if="${#fields.hasErrors('title')}" th:each="err : ${#fields.errors('title')}"></span>

However, post 3.0.8, Thymeleaf-Spring includes th:uerrors for unescaped error messages to the same effect:

<span th:uerrors="*{title}"></span>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.