简体   繁体   中英

Thymeleaf don't expand data-<name> attribute on body tag

I have to downgraded a project with Spring Boot + Thymeleaf to make it work on Tomcat 7 for reasons of the production environment.

I have a Thymelead template where I collect some variables on HTML body tag:

<body th:title="${key}" th:data-key="${key}" th:data-rol="${rol}" th:data-iden="${iden}">

The title attribute was introduced to see that the variable 'key' is collected.

In the original project with Thymeleaf 3.0 (running on Tomcat 8.5) all the variables was collected but with the downgrade to Thymeleaf 2.1.6 only the attribute title is initialized.

Is there any possibility to make the template works with this approach?

我怀疑有没有办法在 Thymeleaf 2 中打开该功能,据说替代语法是这样的(应该适用于所有版本):

<body th:title="${key}" th:attr="data-key=${key},data-rol=${rol},data-iden=${iden}">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM