my dog learned polymorphism*
The moose likes Struts and the fly likes Validating selective fields of a JSP thru Struts Validator Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validating selective fields of a JSP thru Struts Validator Framework" Watch "Validating selective fields of a JSP thru Struts Validator Framework" New topic
Author

Validating selective fields of a JSP thru Struts Validator Framework

Rasesh Kumar
Greenhorn

Joined: Sep 10, 2003
Posts: 4
Hi,

I have a JSP in which I show or hide (using 'if' clause) few fields as per the parameters paased to it. By default (i.e. when no parameters are passed) couple of text fields are shown to the user with a submit button. To use Struts validation framework I have entered required details in the validation.xml file for all the fields that may be shown in my JSP. Now my problem is that whenever I submit the form the validator tries to validate ALL the field of the JSP (whereas the front-end HTML only display and has couple of fields, may be coz the validation.xml has enteries for all the fields) even when they may not have been show to the user.

I have coded in this way just to wrap functionalities of one kind into one front end so that I dont have to code 5 seprate JSPs, 5 seprate forms and 5 action classes.

My questions are: -

1. Is it possible to do what I am trying to do (I am trying get the struts validation framework validate only those fields that are present in the HTML form shown to the user and leave the rest even when their respective enteries are there in the validation.xml file)? If it is possible then how?

2. If it is NOT possible then wot is the best way to go about this problem?

An early response is highly appreciated.
Thanks in advance.

Rasesh Kumar
Rukmini Nagalla
Greenhorn

Joined: Apr 29, 2005
Posts: 11
The following site might help you.
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validating selective fields of a JSP thru Struts Validator Framework