Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

@AssertTrue - how to display validation message in thymeleaf?

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?
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic