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 User Messages in Spring Displaying Validation Messages

Ker Zhang
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ker Zhang
Full Stack JavaScript Techdegree Graduate 29,113 Points

Thymeleaf failed to parse "classappend="${#fields.hasErrors('name')}? 'error' ...'

The classappend failed on my computer.

Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#fields.hasErrors('name'" (category/form:16)

I have to delete it to get the validation page work.

1 Answer

Rebekah Smith
Rebekah Smith
7,263 Points

That exception is from some problem with thymeleaf syntax or a problem with the bound object. It's followed by a more descriptive exception such as IllegalArgumentException.

Looks like in your case there's a syntax error. The syntax in the question header is correct. But the exception points to different syntax where the closing parentheses is missing: "#fields.hasErrors('name'"

I think that spring boot thymeleaf current version doesn't support the thymeleaf attributes anymore sadly because mine doesn't work either and it's not because of the syntax merely that it doesn't know the attribute like th:field