Win a copy of Cloud Native Transformation: Practical Patterns for InnovationE this week in the Cloud/Virtualization forum
or The Go Workshop in the Go forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Validating selective fields of a JSP thru Struts Validator Framework

 
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
 
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
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!