public class ValidatorForm extends ActionForm implements java.io.Serializable
This class extends ActionForm and provides basic field validation based on an XML file. The key passed into the validator is the action element's 'name' attribute from the struts-config.xml which should match the form element's name attribute in the validation.xml.
ValidatorPlugin definition in struts-config.xml for
validation rules.ActionForm,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected int |
page
Used to indicate the current page of a multi-page form.
|
protected org.apache.commons.validator.ValidatorResults |
validatorResults
The results returned from the validation performed by the
Validator. |
multipartRequestHandler, servlet| Constructor and Description |
|---|
ValidatorForm() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
determinePage(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Determine validation page.
If acceptPage of ActionMapping is null, then returns Integer.MAX_VALUE. |
int |
getPage()
Gets page.
|
java.util.Map |
getResultValueMap()
Returns a
Map of values returned from any validation that
returns a value other than null or Boolean
with the key the full property path of the field. |
java.lang.String |
getValidationKey(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Returns the Validation key.
|
org.apache.commons.validator.ValidatorResults |
getValidatorResults()
Get results of the validation performed by the
Validator. |
void |
reset(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Reset all properties to their default values.
|
void |
setPage(int page)
Sets page.
|
void |
setValidatorResults(org.apache.commons.validator.ValidatorResults validatorResults)
Set results of the validation performed by the
Validator. |
ActionErrors |
validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Validate the properties that have been set from this HTTP request, and
return an
ActionErrors object that encapsulates any
validation errors that have been found. |
getMultipartRequestHandler, getServlet, getServletWrapper, reset, setMultipartRequestHandler, setServlet, validateprotected org.apache.commons.validator.ValidatorResults validatorResults
Validator.protected int page
public int getPage()
public void setPage(int page)
page - page numberpublic ActionErrors validate(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
ActionErrors object that encapsulates any
validation errors that have been found. If no errors are found, return
null or an ActionErrors object with no
recorded error messages.validate in class ActionFormmapping - The mapping used to select this instancerequest - The servlet request we are processingActionErrors object that encapsulates any
validation errorsDynaActionFormprotected int determinePage(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
mapping - The mapping used to select this instance.request - The servlet request we are processing.public java.lang.String getValidationKey(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
mapping - The mapping used to select this instancerequest - The servlet request we are processingpublic void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
reset in class ActionFormmapping - The mapping used to select this instancerequest - The servlet request we are processingpublic org.apache.commons.validator.ValidatorResults getValidatorResults()
Validator.public void setValidatorResults(org.apache.commons.validator.ValidatorResults validatorResults)
Validator.validatorResults - results of validationpublic java.util.Map getResultValueMap()
Map of values returned from any validation that
returns a value other than null or Boolean
with the key the full property path of the field.Map of non-null valuesCopyright © 2000–2025 Apache Software Foundation. All rights reserved.