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
In how many ways duplicate form submission can occurs?
Is there a particularly good ide to use with struts?
Explain architecture of struts2?
Difference between struts and spring?
What's mvc pattern ?
Give an example of validates method used to avoid errors.
How to build struts application in eclipse?
When it’s useful to use IncludeAction?
What’s the difference between struts and turbine? What’s the difference between struts and espresso?
How many servlet controllers are used in a Struts Application?
What’s the utilization of struts.xml configuration file?
Explain about token feature in struts?
How client side validation is enabled on a jsp form?
Can we have more than one struts-config.xml file for a single struts application?
What are pull and push mvc architecture and which architecture does struts2 follow?