aspose file tools*
The moose likes Struts and the fly likes Validation in Struts 1.3.x Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation in Struts 1.3.x" Watch "Validation in Struts 1.3.x" New topic
Author

Validation in Struts 1.3.x

Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
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.

- Aditya Webservices Blog
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Validation in Struts 1.3.x