Explain how you can handle the user input with the help of Xml validation.
Answers
Answer:
XML validation is the process of checking a document written in XML (eXtensible Markup Language) to confirm that it is both well-formed and also "valid" in that it follows a defined structure. ... A valid document also respects the rules dictated by a particular DTD or XML schema....
Answer:
XML-based validation You can use a separate XML file that contains your validation rules to validate a user's form field entries. ActionClassName-validation.xml must be the name of the XML file containing the validation rules.
Explanation:
XML-based validation:
You can use a separate XML file that contains your validation rules to validate a user's form field entries. ActionClassName-validation.xml must be the name of the XML file containing the validation rules. The XML validation file for the sample application is called EditAction-validation.xml and can be found in the src/main/resources/org/apache/struts/edit/action directory.
XML Validator Format
In the XML validation file (for this example that is EditAction-validation.xml), is this XML:
XML Validator Required String
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<validators>
<validator type="requiredstring">
<param name="fieldname">personBean.firstName</param>
<message>First name is required.</message>
</validator>
</validators>
You can have one or more validator nodes inside the validator node. Which validator you want the Struts 2 framework to employ is specified by the type property (see Validation ). The framework is instructed by the form field input to apply the rule by the param name=" field name" node. The form fields and their name values are listed in the edit.JSP; if you are unfamiliar with how to utilise Struts 2 form tags, please examine Struts 2 Form Tags. The framework is instructed on what message to display if the validation is unsuccessful using the message node.
learn more about it
https://brainly.in/question/13107596
https://brainly.in/question/7498416
#SPJ2