This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java 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
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • salvin francis
  • Piet Souris

*IGNORE* SimpleFormController. Database validation in onSubmit(). Problem calling showForm()

Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

EDIT: No longer a question I need an answer to!

I have a controller to handle a login form. It extends Spring's SimpleFormController. According to the documentation for this controller (see

The submit behavior can be customized by overriding one of the onSubmit methods. Submit actions can also perform custom validation if necessary (typically database-driven checks), calling showForm in case of validation errors to show the form view again.

This is what I want to do. Please note: I have a validator linked to the form which I want to deal with "plain data" validation only. I don't want to do the database-driven validation there.

I'm now looking at the documentation for the showForm() methods (,%20javax.servlet.http.HttpServletResponse,%20org.springframework.validation.BindException)). They take an object of BindException so figure I have to create one to pass to showForm().

Looking at the documentation for BindException: ( and I get informed that:

As of Spring 2.0, this is a special-purpose class. Normally, application code will work with the BindingResult interface, or with a DataBinder that in turn exposes a BindingResult via DataBinder.getBindingResult().

So, can someone please tell me what I need to do, or how I can perform my database-backed validation?



EDIT: the onSubmit receives the a BindException object called errors! I really apologise for the post!!
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the update. You should also add some bold or red text in the beginning of the question.
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!