aspose file tools*
The moose likes Struts and the fly likes Problem with Struts2 validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with Struts2 validation" Watch "Problem with Struts2 validation" New topic
Author

Problem with Struts2 validation

kooper Sivan
Greenhorn

Joined: Jul 01, 2011
Posts: 16
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

Joined: Jan 21, 2011
Posts: 129

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

Joined: Jul 01, 2011
Posts: 16
Thanks Nitin..
Will try out the same
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem with Struts2 validation