How to process and append a string in the timeline

I have a list of strings - the names of the objects that interest me: I want to join the values ​​of these strings, but not use the property name, but the property values ​​for them. I saw that the starting point #strings.listJoinis - but how can I say to match the items in the list versus their value in the property files?

The list will be: [name, address]and in the properties file I have:

name=stg
address=another something
I would like to get the line: stg, another something
+4
source share
1 answer

You can do this using #messages.listMsgand#strings.listJoin

Returning the model from your @Controller:

model.addAttribute("messageKeyList", Lists.newArrayList("name", "address"));

You can join the list of translated messages as follows:

<div th:text="${#strings.listJoin(#messages.listMsg(messageKeyList), ',')}"></div>

, , :

Some name,Some address

.

+5

Source: https://habr.com/ru/post/1535724/


All Articles