Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Spring MVC form validation issue

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm modifying a project from Spring In Action by Walls. The project is chapter six's thymeleaf mvc project. I'm adding a confirm password field to the registration form which is backed by a Spitter Object. I add validation to the project to check for the length of the password field and to check that the password and confirmPassword fields match. The Spitter form backing object is



The SpitterController is



The registrationForm is



I have a message resource bundle for Spring-manage messages, messages.properties:



And a ValidationMessages.properties for the JSR 303 and Hibernate Validator messages:



The message validation seems to work well except for one issue. When I force a password mismatch, I see something like the following (see attached png file):

Register

Please fix the following error(s)

spitter.password.mismatch.message
Your passwords don't match. Please try again
....

Instead of the single "Your passwords don't match. Please try again." message, I also see "spitter.password.mismatch.message" as a message and can't figure out why.
spttrRegister3.png
[Thumbnail for spttrRegister3.png]
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!