Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

@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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!