• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

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

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?

Thanks,

Ed

EDIT: the onSubmit receives the a BindException object called errors! I really apologise for the post!!
 
Hong Anderson
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic