Class AbstractForm

java.lang.Object
name.matthewgreet.strutscommons.form.AbstractForm
All Implemented Interfaces:
Serializable, Form
Direct Known Subclasses:
AbstractFormattableForm, NullForm

public abstract class AbstractForm extends Object implements Form, Serializable
Template for class that receives form data for form driven Actions.
See Also:
  • Constructor Details

    • AbstractForm

      public AbstractForm()
  • Method Details

    • resetFields

      public void resetFields()
      Sets all displayed fields to default values for data entry of a new record, which is usually an empty string.
      Specified by:
      resetFields in interface Form
    • doValidate

      @Deprecated public void doValidate(ValidationAware validationAware, TextProvider textProvider)
      Deprecated.
      Replaced by #doValidate2, which can recognise warning messages.
      Validates and parses form data itself, such as required fields or date validation, writing any error or field messages to the ValidationAware message receiver. Any error message indicates a failure.
      Specified by:
      doValidate in interface Form
      Parameters:
      validationAware - Error message receiver, usually the calling action.
      textProvider - Message name translator that generates localised text, if this is set up. This is usually ignored as no localisation is set up.
    • doValidate2

      public void doValidate2(ValidationAware2 validationAware, TextProvider textProvider)
      Validates and parses form data itself, such as required fields or date validation, writing any error or field messages to the ValidationAware2 message receiver. Any error message indicates a failure..
      Specified by:
      doValidate2 in interface Form
      Parameters:
      validationAware - Error message receiver, usually the calling action.
      textProvider - Message name translator that generates localised text, if this is set up. This is usually ignored as no localisation is set up.
    • manualParameterConvert

      public ManualParameterConversionResult manualParameterConvert(Map<String,String> unprocessedParameters, ValidationAware validationAware, TextProvider textProvider)

      Sets, converts and validates form fields from unprocessed request parameters, writes any error messages, and returns the names of successfully processed parameters and unsuccessfully processed parameters. Where multiple request parameters have the same name, only the first is presented.

      Unprocessed parameters are those that haven't set a form field for a number of reasons.

      • No form field has the same name.
      • Form field is annotated with ManualParameterConversion.
      • Form field is a non-string array type.
      Specified by:
      manualParameterConvert in interface Form