aspose file tools*
The moose likes Struts and the fly likes When to use Validation Method and when to use Validation Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "When to use Validation Method and when to use Validation Framework" Watch "When to use Validation Method and when to use Validation Framework" New topic
Author

When to use Validation Method and when to use Validation Framework

Siva Nagireddy
Greenhorn

Joined: Jan 25, 2008
Posts: 3
Hi All,
I have a doubt in Struts as When to use the validation method and when to use Validation Framework for handling the errors.I am getting confused about it .Please explain with an example.

Thanks & Regards,

S.Siva Nagi Reddy
sita raman subra
Ranch Hand

Joined: Apr 09, 2007
Posts: 47
Hi,

The purpose of Validation framework is to avoid the java script in our application.

You need to use validation framework if you want to use the validation which is already in the framework like email validation,check length etc...

If use want to define a new validation for your application you need to go for validation method.

Regards,
Sitaraman
Vector Jones
Greenhorn

Joined: Oct 17, 2007
Posts: 1
The validate method has its shortcomings. Often, for example, validation code is heavily duplicated throughout an application because many fields require the same validation logic. Any change in the validation logic for similar fields requires code changes in several places, as well as recompilation of the affected code.
Whereas the Validator framework comes prepackaged with several validation routines, making the transition from hard-coded validation logic painless. Instead of coding validation logic in each Form Bean�s validate( ) method, with Validator you use an XML configuration file to declare the validations that should be applied to each Form Bean. If you need a validation not provided by Validator, you can plug your own custom validations into Validator. Additionally, Validator supports both server-side and client-side (JavaScript) validations whereas Form Beans only provide a server-side validation interface.
 
jQuery in Action, 2nd edition
 
subject: When to use Validation Method and when to use Validation Framework