© 2002 BEA Systems, Inc.


com.bea.p13n.appflow.webflow.forms
Interface ValidatedForm


public interface ValidatedForm
extends ValidatedFormConstants

The ValidatedForm class is used to validate http form data. It works in conjunction with the ValidatedValues object and plugable Validators This class is designed to help by providing additional functionality in retrieving and validating HTML Form data. This class is designed to be called from an InputProcessors and work in conjunction with the webflow:validatedForm JSP tags. Fields are retrieved from the HtttpServletRequest and objects are validated per method call. Messages are bits of information displayed back on the browser screen indicating what is wrong with the field.

Example

Email addresses must be in name@domain format

It is the intent that messages will be pulled from a weblogic message catalog to support internationalization and customization, unless supplied per method call.


Fields inherited from class com.bea.p13n.appflow.webflow.forms.ValidatedFormConstants
EMAIL_VALIDATOR, NUMBER_VALIDATOR, PHONE_VALIDATOR, REGEXP_VALIDATOR, SPECIAL_CHARACTER_VALIDATOR, STRING_VALIDATOR
 
Method Summary
 void addValidator(java.lang.String ValidatorClassName)
          Add Custom Validator to the pool of validators.
 void validate(ValidatedValues validatedValues, java.lang.Object bean)
          For each HttpRequest parameter try and call a setter on the bean.
 java.lang.String validate(ValidatedValues validatedValues, java.lang.String RequestParam)
          Retrieve an HttpServletRequest parameter and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.
 java.lang.String validate(ValidatedValues validatedValues, java.lang.String validatorClassName, java.lang.String requestParam, java.lang.Object expression)
          Validate an HttpServletRequest parameter using the supplied validator and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.
 java.lang.String validate(ValidatedValues validatedValues, java.lang.String validatorClassName, java.lang.String requestParam, java.lang.Object expression, java.lang.String message)
          Validate an HttpServletRequest parameter using the supplied validator and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.
 void validate(ValidatedValues validatedValues, Validatable validatableBean)
          For each HttpRequest parameter try and call a setter on the bean.
 java.util.Collection validateMultiple(ValidatedValues validatedValues, java.lang.String requestParam)
          Retrieve an Collection of HttpServletRequest parameters and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.
 java.util.Collection validateMultiple(ValidatedValues validatedValues, java.lang.String paramName, int minimum)
          Retrieve an Collection of HttpServletRequest parameters and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.
 java.util.Collection validateMultiple(ValidatedValues validatedValues, java.lang.String paramName, int minimum, java.lang.String message)
          Retrieve an Collection of HttpServletRequest parameters and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.
 

Method Detail

validate

public java.lang.String validate(ValidatedValues validatedValues,
                                 java.lang.String validatorClassName,
                                 java.lang.String requestParam,
                                 java.lang.Object expression)
                          throws MissingFormFieldException
Validate an HttpServletRequest parameter using the supplied validator and place the results into the ValidatedValues object to be retrieved by the webflow validated tags. The error message will be retrieved from the internationalized message catalog ValidationException.xml

Parameters:
validateValues - validatedValues object.
validatorClassName - the class name of the validator.
RequestParam - the HttpServletRequest parameter.
expression - optional expression object for the validator if the validator does not use and expression object you may pass null.
Returns:
the formatted request parameter value.
Throws:
InvalidValidatorException - if bad validator.
MissingFormFieldException - if the requestParam is not in the request.

validate

public java.lang.String validate(ValidatedValues validatedValues,
                                 java.lang.String validatorClassName,
                                 java.lang.String requestParam,
                                 java.lang.Object expression,
                                 java.lang.String message)
                          throws MissingFormFieldException
Validate an HttpServletRequest parameter using the supplied validator and place the results into the ValidatedValues object to be retrieved by the webflow validated tags.

Parameters:
validateValues - validatedValues object.
validatorClassName - the class name of the validator.
RequestParam - the HttpServletRequest parameter.
expression - optional expression object for the validator if the validator does not use and expression object you may pass null.
message - a error message to be supplied instead of retrieving one from the internationalized message catalog.
Returns:
the formatted request parameter value.
Throws:
InvalidValidatorException - if bad validator.
MissingFormFieldException - if the requestParam is not in the request.

validate

public java.lang.String validate(ValidatedValues validatedValues,
                                 java.lang.String RequestParam)
Retrieve an HttpServletRequest parameter and place the results into the ValidatedValues object to be retrieved by the webflow validated tags. This method does not perform any validation. It only returns the value from the HttpServletRequest and retains it ValidatedValues if needed to preserve input. This method is usually used for simple form fields such as: checkbox and, radio buttons. Where there is no validation but we still want to retain the value.

Parameters:
validateValues - validatedValues object.
RequestParam - the HttpServletRequest parameter.
Returns:
the request parameter value or null.

validateMultiple

public java.util.Collection validateMultiple(ValidatedValues validatedValues,
                                             java.lang.String paramName,
                                             int minimum)
                                      throws MissingFormFieldException
Retrieve an Collection of HttpServletRequest parameters and place the results into the ValidatedValues object to be retrieved by the webflow validated tags. This method is used for multi select combo boxes. If the minimum number of items are not selected the validation will not pass and the user will be presented with a internationalized message from the message catalog ValidationException.xml

Parameters:
validateValues - validatedValues object.
paramName - the HttpServletRequest parameter.
minimum - the minimum number of items the user must select to pass validation.
Returns:
a Collection of Strings representing the users selection
Throws:
MissingFormFieldException - if the requestParam is not in the HttpRequest.

validateMultiple

public java.util.Collection validateMultiple(ValidatedValues validatedValues,
                                             java.lang.String paramName,
                                             int minimum,
                                             java.lang.String message)
                                      throws MissingFormFieldException
Retrieve an Collection of HttpServletRequest parameters and place the results into the ValidatedValues object to be retrieved by the webflow validated tags. This method is used for multi select combo boxes. If the minimum number of items are not selected the validation will not pass and the user will be presented with the supplied message

Parameters:
validateValues - validatedValues object.
paramName - the HttpServletRequest parameter.
minimum - the minimum number of items the user must select to
message - a error message to be supplied instead of retrieving one from the internationalized message catalog.
Returns:
the request parameter value or null.
Throws:
MissingFormFieldException - if the requestParam is not in the HttpRequest.

validateMultiple

public java.util.Collection validateMultiple(ValidatedValues validatedValues,
                                             java.lang.String requestParam)
Retrieve an Collection of HttpServletRequest parameters and place the results into the ValidatedValues object to be retrieved by the webflow validated tags. This method is used for multi select combo boxes. This method does not expect any minimum or maximum number of items to be selected. If no items were select or the requestParam is not in the HttpRequest you will be returned a non null empty ArrayList.

Parameters:
validateValues - validatedValues object.
requestParam - the HttpServletRequest parameter.
Returns:
a non null Collection

validate

public void validate(ValidatedValues validatedValues,
                     java.lang.Object bean)
For each HttpRequest parameter try and call a setter on the bean. The bean must follow normal bean conventions (i.e. have a set method for each parameter.

Parameters:
validateValues - validatedValues object.
bean - java bean.

validate

public void validate(ValidatedValues validatedValues,
                     Validatable validatableBean)
For each HttpRequest parameter try and call a setter on the bean. The bean must follow normal bean conventions (i.e. have a set method for each parameter. The bean must also implement Validatable. After all the setters have bean called the ValidatedForms class will call validate method on the Validatable bean. It is the job of the bean to validate all fields and update the status and message in the ValidatedValues object. The ValidatedForms class will then handle updating the invalid field count.

Parameters:
validateValues - validatedValues object.
validatableBean - a java bean that implements Validatable

addValidator

public void addValidator(java.lang.String ValidatorClassName)
Add Custom Validator to the pool of validators. It is not necessary to invoke this when writing custom validators. If the validatator does not exist at time of validation the system will add it for you. However, this can be call to preload you validator to avoid an initial hit.

Parameters:
Validator - class name of the validator class

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved