Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to use Validation Method and when to use Validation Framework

 
Siva Nagireddy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic