• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation in Struts 1.3.x

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I want to know if I can use the commons-validation framework (validation.xml) and also the validator method (in Validator Form) both simultaneously. What I need is a situation where the basic validations pertaining to empty fields and the like are done in the validation.xml and business logic based validation are done in validator method. Currently I am doing the buisiness validation in the Action but wanted to make it neater. Thanks.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you try a simple form validations using both Struts validation framework with overriding "validate()" method in validtor form and let us know after calling validation JavaScripts whether the "validate()" method gets called or not ?
 
Aditya Keyal
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already tried that and only the validation.xml gets invoked. Struts bypasses the over-ridden validation method in form. Thats why I had to actually write the business validation in Action. I was wondering if there was some other way that can get the job done.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aditya Keyal wrote:I have already tried that and only the validation.xml gets invoked. Struts bypasses the over-ridden validation method in form.


Then you tried a wrong way or misconfigured something. Two things to look out for while making this kind of validation succeed:

  • Make you Action Forms of type ValidatorForm, means extends ValidatorForm
  • Make attribute "validate="true" in action mapping.


  • HTH
     
    Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic