displaying 2 variables in a message

classic Classic list List threaded Threaded
3 messages Options
cel
Reply | Threaded
Open this post in threaded view
|

displaying 2 variables in a message

cel
I'd like to display a custom message with 2 variables.

In my message.properties, I've written the following line :
customMessage=Hello {0} {1}

And in my template, I've tried this syntax :
<p th:text="#{customMessage(${lastname},${firstname})}">

but it doesn't work. I've got a SpelParseException.

In the documentation, it is said that variables can be separated with comma.

I suppose it is not the good syntax, but I don't know how to display my variables.

Thank you for any help in advance.
Reply | Threaded
Open this post in threaded view
|

Re: displaying 2 variables in a message

Zemi
Administrator
Hi,

the syntax is OK, so maybe the problem is with the parameters, try debugging

   <p th:text="${lastname}"></p>
   <p th:text="${firstname}"></p>
cel
Reply | Threaded
Open this post in threaded view
|

Re: displaying 2 variables in a message

cel
Thanks a lot, it works. (I think I had another problem in my code which caused the error)