• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
spring-valdiation.png
[Thumbnail for spring-valdiation.png]
My directory structure
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sudarshan jadhav
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic