Using the ValidateForm from Struts 1, we will be able to validate the FORM used in the Struts,
I went through number of links (https://cwe.mitre.org/data/definitions/103.html) still not able to figure the functionality of super.validate() method in Struts
Default Validation (using super.validate() in Struts):
public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {
// private variables for registration form
private String name;
private String email;
...
public RegistrationForm() {
super();
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = super.validate(mapping, request);
if (errors == null) {
errors = new ActionErrors();
}
return errors;
}
// getter and setter methods for private variables
}
In the above code what is the significance of super.validate() method, What is the validation does it perform? Could someone explain this please!
It performs validation of request parameters according to the rules defined in
validation.xml. It provides the basic validation and if you want to use a custom validation then you should override itsvalidate()method. Here's the description of the method:What happens if you override
validate()and not callingsuper.validate():