Bummer! You must be logged in to access this page.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Spring with Hibernate - Thymeleaf question

I really would like to understand why when I am working with Thymeleaf template in my IntelliJ, the the IDE displays Thymeleaf expression variables as errors ... but not on the instructor IDE. Example

${colors}" th:value="${color.hexCode}

colors and Color.hexCode will show red line under them in my IDE, but they look fine in the instructor's video. The code run fine, but it hard to debug a real problem when the page is full of red lines.

Question: What magic the instructor is applying to make these lines go away then there are no invalid syntax.

Thanks

1 Answer

The problem is that the GIF templates files have theses tags <!DOCTYPE html> <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"> <head th:replace="layout :: head(${gif.description})"></head>

whereas the Category Template items were missing this tag <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

This was causing Category errors before I even got a chance to start.

My initial work around was to add this to the Category template files <html lang="en" xmlns:th="http://www.thymeleaf.org">

as in <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head th:replace="layout :: head(${gif.description})"></head>

Eventhough this got the code going, the Thymeleaf rendering was showing redline as I described previously.

I opened a ticked with the Intellij folks and they responded ....this is not supported yet ... working on a fix.

in any case, I resolved all by making all files under Category Template have these tags <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"> and removed the one I added earlier <html lang="en" xmlns:th="http://www.thymeleaf.org">

This solved the rendering problem

thanks