thymeleaf-spring icon indicating copy to clipboard operation
thymeleaf-spring copied to clipboard

Template engine adds more then <th:object> ... </th:object>

Open rarapost opened this issue 6 years ago • 0 comments

I have tried to use <th:block th:fragment="..."> to replace part of HTML content in templates. I have multiple fragments in single "layout" file that.

It seems to work, but in case sequence <th:block th:fragment="..."> in the direct order (e.g. without any other "wrapper" elements), the rest of "layout" file is added ad a fragment content (not only code between <> and </> tags, but also following HTML elements that are placed after requested element)

The workaround is to enclose codem that I want use as a part of the template, to anothed (unnecessary) HTML tagd. Any tag works, including th:block.

I am adding simple spring boot application, where you can verify the behavior: template-test.zip.

In the app, pages "/status1" and "/status2" behave incorrectly, pages "/status3" and "/status4" have added "wrapper" elements to the layout (files "layoutX.html") and behave correctly.

rarapost avatar Mar 22 '19 16:03 rarapost