Quantcast

Avoid "Message key for message resolution must be a non-null and non-empty String"

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Avoid "Message key for message resolution must be a non-null and non-empty String"

migueldeblas
I have this thymeleaf code:

<input type="text" th:field="*{name}" th:placeholder="#{${placeholder}}" th:if="${mode == 'update'}"/>

If ${placeholder} has a no empty string it woks but if ${placeholder} is null or empty string thymeleaf throws an exception:
org.thymeleaf.exceptions.TemplateProcessingException: Message key for message resolution must be a non-null and non-empty String

Is there any way to avoid this error by changing the "th:placeholder" tag when ${placeholder} is null/empty?
Result input without "placeholder" or with placeholder = "".

Loading...