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

Whats the difference between the default namespace and the root namespace?

515


What is the purpose of @validations annotation?

563


State an example of struts configuration file as an action parameter for action servlet.

535


What are the custom tags?

528


What is pojo in struts2?

562






What are the life cycle methods of interceptor?

520


Is struts mvc framework?

479


How to combine the struts with velocity template?

490


What is the purpose of form-be tag in struct-config.xml?

560


What is action support class in struts2?

563


What is the purpose of @doublerangefieldvalidator?

608


What is spring hibernate and struts in java?

486


Which design pattern is implemented by Struts2 interceptors?

550


What is the difference between empty default namespace and root namespace?

554


How is the action mapping specified?

546