• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

@AssertTrue - how to display validation message in thymeleaf?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to compare 2 passwords to see if they match, I can do that with a field and `@AssertTrue`, however I cannot display the message if validation fails.

I am trying like so:


And in the view:



Using breakpoints, I can see that all values are correct as expected, however I **always** get the error message, even if the passwords match.

It seems that the `passFlag` does not change its value for validation even with `@AssertTrue` being true (because when I use breakpoints to see the values I can see that the `passFlag` has correct value, but I **still** get the error message).

So how can I modify the above code to work with the error message, and even better - is there a better to compare the 2 fields and display an error message if need be?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!