Thymeleaf breaking in 6.7.3

Enonic version: 6.7.3
OS: Mac OS Sierra

Hey guys,

Ever since I updated my project to 6.7.3, I’ve been into a lot of issues with Thymeleaf. One of them, that makes the whole site woe and trow up a 500, is that, whenever I add a fragment (via insert or replace), if that fragment is also adding another fragment, then the whole thing breaks, and an error will be thrown for the line 0 of the main page.

Any idea what is going on, and how to fix it?

Here’s the error it throws:
An error happened during template parsing (template: "xxxxxxx.html") (com.enonic.xp.resource.ResourceProblemException) In xxxxxxx.html at line 0



Could you paste in some code and I will create a test to replicate it. Not sure how to fix that yet, but it may be a problem with Thymeleaf 2.x.

Worth mentioning, but maybe not relevant in this case, is that the new Thymeleaf in XP isn’t as forgiving as before with self-closing html tags like <img/>, <meta/> , <link/>. Even though HTML5 supports them not being closed, Thymeleaf doesn’t comply with that standard.

Thanks for the reply, but yup, I know about the self-closing tags, not the issue here.

I found the problem and was able to bypass it.
As I mentioned, the problem happens when a fragment that is being included/replaced is including/replacing another fragment on its own.

What I did to fix this, was using the fragments injection, introduced in 3.x.
So, everything is handled by the main html part instead.

Like for example:

2.x way of doing it:

<-- part1.html -->
< div th:replace=“part2”>

<-- part2.html -->
< div th:replace=“part3”>

And now only work if I put it as:

<-- part1.html -->
< div th:replace=“part2.html :: p2(~{part3})”>

<-- part2.html -->
< div th:fragment=“p2(part3)”>
< div th:replace="${part3}">

(can’t format that properly, sorry if not understandable :frowning: )

Did you upgrade from 6.7.2, or some earlier version?

Hi, I’ve updated from the 6.5.1 (we were using the 6.6.1 server files, but someone left the gradle pointing to 6.5.1…)

Okay. Thanks. That makes sense. :slight_smile: