Thymeleaf sytax of expression for multiple parameters

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

Thymeleaf sytax of expression for multiple parameters

lbenedetto
The documentation says that you can use parameters in your strings like so:

    home.welcome=¬°Bienvenido a nuestra tienda de comestibles, {0}!

    <p th:utext="#{home.welcome(${user.name})}">
      Welcome to our grocery store, Sebastian Pepper!
    </p>

And indeed, that is working for me.

It also says that "several parameters can be specified, separated by commas."

However, I cannot figure out the syntax for multiple parameters.

My source string is something like

    home.welcome=Welcome to {0} store, {1}!

And I have tried the following expressions

    1. #{home.welcome((${store.name}),(${user.name}))}
    2. #{home.welcome(${store.name}, ${user.name})}
    3. #{home.welcome(${store.name, user.name})}
    4. #{home.welcome(${store.name}),(${user.name})}
 
Which all give TemplateProcessingException: Could not parse as expression, except #4 which gives ??home.welcome(${store.name}),_en??

What is the correct syntax of the expression for loading two parameters into a template string?

I have also asked this question on Stack Overflow

https://stackoverflow.com/questions/55302783/thymeleaf-sytax-of-expression-for-multiple-parameters
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf sytax of expression for multiple parameters

lbenedetto
#2 is correct, but there was a problem in the source string.