Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 3 form validation

 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my application I want to validate the field which contains reference to another domain object (Address in this case). I am able to validate name and age fields, but not able to validate fields from Address class (no message is displayed on jsp).


 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us what you have tried. What does your JSP.,controller, validation logic look like?

 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Details given below. Please note that validation is working fine for Article (only few fields I am validating for now), but isn't working for User which is referred from Article.

Article.java



User.java



ArticleController.java



relevant snippet from despatcher servlet (for JSR 303 & messages) is as below,



addArticle.jsp

 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem is resolved for me now. Just read the document at http://docs.jboss.org/hibernate/validator/4.0.1/reference/en/html/validator-usingvalidator.html

I added,



before

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic