• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validating selective fields of a JSP thru Struts Validator Framework

 
Rasesh Kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following site might help you.
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic