• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

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: 2265
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: 2265
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: 2265
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic