• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London

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

Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/mvc/SimpleFormController.html):

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 (http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/mvc/SimpleFormController.html#showForm(javax.servlet.http.HttpServletRequest,%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: (http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/validation/BindException.html) 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the update. You should also add some bold or red text in the beginning of the question.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic