How to carryout the validations in struts if the validator
frame work cant handle the validation

Answer Posted / srilatha ghanta

Struts supports two types of validation
1)"pro grammatical validations" ,performed using
validate()method in form bean.
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
}
validate method return type is ActionErrors ,it holds set of
ActionError objects.


2)"declarative validations" ,handled by struts frame work only.
Struts provides a XML file validator-rules.xml which
contains standard validation methods

so this fie is configured into our application like this in
struts-config.xml file using <plug-in >tag.
we are having the responsibility inform to framework which
validations only u are using in Ur applications.that
particular keys can be defined in validation.xml file.
this file also configured in struts-config.xml
<plug-in
className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/org/apache/struts/validator/validator-rules.xml,
/WEB-INF/validation.xml" />
</plug-in>

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you explain struts validator framework?

571


How to override the default error message that can come during file uploading process?

568


What are the steps of struts installation?

567


What is the default location of result pages and how can we change it?

550


Which tag is used to declare constants in struts xml?

466






What are the conditions for actionform to work correctly?

517


How many Action classes have been used in your project? Differences between struts 1.1 and 1.3?

2530


What is actionform in struts?

479


Which class is the Front Controller in Struts2?

538


Is Struts Framework part of J2EE?

607


How can you create your custom interceptor in struts 2?

537


What are the benefits of Interceptors in Struts2?

642


What configuration changes are required to use Tiles in Struts?

563


What are the classes used in struts?

622


What is request processor and how does it relates to action mapping?

575