Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Spring with Hibernate User Messages in Spring Displaying Validation Messages

Ker Zhang
.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