the key for the messages.properties
lookup are provided by my Java Class, as you can see here (where i
is a variable in a th:each
loop):
th:text="#{${i.nameKey}}"
public String getNameKey() {
// getKeyPrefix() generates a unique name from the class attributes
return getKeyPrefix() + ".name";
}
This works fine.
Now I want to check if the value in the messages.properties
file is null or empty for the given key:
th:if="${#messages.msg(i.nameKey) != null AND NOT #string.isEmpty(#messages.msg(i.nameKey))}"
But i can't pass the messages
object into the isEmpty
method.
Any idea?
Thanks!