• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Hibernate form validation doesn't pick up errors

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I'm new to spring and have been trying to get a simple validation form working.

When I submit the form with an empty string for the playerName, the validation error does not get picked up in the controller and continues forward.

Here's what I have so far :

Participant.java



ParticipantController.java



participant-form.jsp



ParticipantController.java



pom.xml


 
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you may need this dependency as well :


Reference:
https://www.baeldung.com/javax-validation
 
Himai Minh
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Saggi
Another question for you is, what spring boot version do you use ?
 
Himai Minh
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Saggi,
Depending on what spring boot version you are using, you may need to include different dependency for validation.
Here is a helpful article:

https://stackoverflow.com/questions/48614773/spring-boot-validation-annotations-valid-and-notblank-not-working
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic