org.apache.struts.validator
Class ValidatorForm
- Serializable
public class ValidatorForm
implements 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.
- See
ValidatorPlugin
definition in struts-config.xml
for validation rules.
$Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $private static Log | log - Commons Logging instance.
|
protected int | page - Used to indicate the current page of a multi-page form.
|
protected ValidatorResults | validatorResults - The results returned from the validation performed
by the
Validator .
|
int | getPage() - Gets page.
|
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.
|
String | getValidationKey(ActionMapping mapping, HttpServletRequest request) - Returns the Validation key.
|
ValidatorResults | getValidatorResults() - Get results of the validation performed by the
Validator .
|
void | reset(ActionMapping mapping, HttpServletRequest request) - Reset all properties to their default values.
|
void | setPage(int page) - Sets page.
|
void | setValidatorResults(ValidatorResults validatorResults) - Set results of the validation performed by the
Validator .
|
ActionErrors | validate(ActionMapping mapping, 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.
|
log
private static Log log
Commons Logging instance.
page
protected int page
Used to indicate the current page of a multi-page form.
validatorResults
protected ValidatorResults validatorResults
The results returned from the validation performed
by the Validator
.
getPage
public int getPage()
Gets page.
getResultValueMap
public 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.
getValidationKey
public String getValidationKey(ActionMapping mapping,
HttpServletRequest request)
Returns the Validation key.
mapping
- The mapping used to select this instancerequest
- The servlet request we are processing
- validation key - the form element's name in this case
getValidatorResults
public ValidatorResults getValidatorResults()
Get results of the validation performed by the
Validator
.
- results of the validation
reset
public void reset(ActionMapping mapping,
HttpServletRequest request)
Reset all properties to their default values.
- reset in interface ActionForm
mapping
- The mapping used to select this instancerequest
- The servlet request we are processing
setPage
public void setPage(int page)
Sets page.
setValidatorResults
public void setValidatorResults(ValidatorResults validatorResults)
Set results of the validation performed by the
Validator
.
validatorResults
- results of validation
validate
public ActionErrors validate(ActionMapping mapping,
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. If no errors are found, return
null
or an ActionErrors
object with no
recorded error messages.
- validate in interface ActionForm
mapping
- The mapping used to select this instancerequest
- The servlet request we are processing
ActionErrors
object that encapsulates any validation errors
Copyright B) 2000-2007 - The Apache Software Foundation