Getting the put-list Tiles attribute to work with the Thymeleaf template

I am trying to get Apache Tiles ' put-list-attribute to work with Thymeleaf .

Here is what I tried:

From the Tiles configuration:

 <put-list-attribute name="jsFilesList"> <add-attribute value="/js/libs/jquery-1.8.1.js"/> <add-attribute value="/js/libs/jquery-ui-1.9.0.custom.js"/> <add-attribute value="/js/libs/bootstrap.js"/> </put-list-attribute> 

From the team template:

 <script th:each="jsFile : ${jsFilesList}" th:src="@{${jsFile}}" type="text/javascript" ></script> 

Nothing is displayed ... It seems that the list is empty in terms of the timeline template ...

Can anybody help?

+4
source share
1 answer

Tiles attributes are not available by default in the request area. They live in their area.

In jsps, to set the tile attribute from your area to the request area, do the following:

<%@ taglib prefix="tilesx" uri="http://tiles.apache.org/tags-tiles-extras" %> <tilesx:useAttribute id="jsFilesList" name="jsFilesList"/>

+1
source

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


All Articles