Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Struts2 validation

 
kooper Sivan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am facing an issue with Struts 2 validation.
I am using the same page for multiple users, there by the fields become hidden for different users, but i use the same action class and have a common validation.xml file,
the issue now is that since all the fields are made mandatory in the xml file, even if the fields are not visible at the front end, the submission doesn't happen.
i tried removing the piece of validation for the property not visible in that page for that user and it went through fine.

Requesting your help.

Thanks...
Kooper
 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for all those fields which are not required, simply add a <s:hidden with their name and some garbage value> so that it'll pass required validation.
 
kooper Sivan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nitin..
Will try out the same
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic