wood burning stoves 2.0*
The moose likes Spring and the fly likes how to validation performed in spring 3 and hibernate 3 using multiactioncontroller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "how to validation performed in spring 3 and hibernate 3 using multiactioncontroller" Watch "how to validation performed in spring 3 and hibernate 3 using multiactioncontroller" New topic
Author

how to validation performed in spring 3 and hibernate 3 using multiactioncontroller

sudarshan jadhav
Ranch Hand

Joined: May 28, 2012
Posts: 42
My problem is that spring and hibernate configuration successful but validation in spring is not done in custom type(not annonation) by using xml mapping.
I am write validation logic of validate class but how to map that class with dispatcher-servlet.xml file please given me solution on that my reqired is by using multiactioncontroller,xml mapping and spring and hibernate3
Thank you in advance..
My jsp ,java and project struture is follows:


My jsp is :redirect.jsp

Spring xml file:
dispatcher-servlet.xml


My mutiactioncontroller class is:
UserController.java



My validator class is:
UserValidator.java


My bean class is:
Use.java


My Dao interface class:
UserDAO.java


My DAO class:
UserDAOImpl.java


My properties file:messages_en_US.properties
name.required = User Name is required

password.required = Password is required

gender.required = Gender is required

country.required = Country is required

aboutYou.required = About You is required

community.required = Select at least one community



[Thumbnail for spring valdiation.png]

Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

Before we get to far down this path why are you using Multi-action controller. The fact that it is deprecated in your code shows that you are using a newer version of Spring which I would have recommended otherwise. I suggest you re-write this using the more modern @Controller paradigm. You will not find much support for these legacy controllers which will likely be removed in one of the next few releases.


[How To Ask Questions][Read before you PM me]
sudarshan jadhav
Ranch Hand

Joined: May 28, 2012
Posts: 42
Thank you Bill for reply,
I am new in spring and i have done create,delete,update and read operation using multiactioncontroller class but my problem is that how to configure validator class in dispatcher-servlet.xml when user not enter any value in jsp page the error msg is display on jsp page . I am done using simpleactioncontroller but problem is that only page validation is done but database operation is not performed.
Please help me on multiactioncontroller validation and xml mapping.
sudarshan jadhav
Ranch Hand

Joined: May 28, 2012
Posts: 42
Please help me i have done mapping in dispatcher-servlet.xml and UserValidation class is called when userForm.jsp page fields are blank and user click on submit button in UserActionController class called in that errors are bind successfully but error is through on jsp page is follows:



My UserController class is:



My UserValidator class is:


My new dispatcher-servlet.xml is :

my directory structure as above attachement file and jsp page as above
please help to solve the error about binding to userForm when user click on submit button and all field are blank show on that page error message
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

Once again since you are new to Spring forget about the multi action controller and learn to do it the modern way with a new version of Spring not using deprecated classes. If you do this an have a question we can help. I would start with working of a newer tutorial. Try this one:

http://blog.springsource.org/2012/08/29/integrating-spring-mvc-with-jquery-for-validation-rules/
the source code for that is here:
https://github.com/michaelisvy/ajax-samples

or alternatively if you want to do it by implementing Validator then take a look at this post which at least uses the more modern controllers
http://stackoverflow.com/questions/4031266/spring-3-mvc-show-validation-message-with-custom-validator
sudarshan jadhav
Ranch Hand

Joined: May 28, 2012
Posts: 42


Thank you Bill once again for reply,
I have done validation using modern way i.e @controller thank you for give me link for references .This link is use to solve the validation problem in spring3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to validation performed in spring 3 and hibernate 3 using multiactioncontroller