Annotation Type StringCSVConversion


@Documented @Inherited @Target(FIELD) @Retention(RUNTIME) public @interface StringCSVConversion

Defines a form field (whether on a Struts Action or model of ModelDriven Struts Action) should be parsed from comma separated values to some collection of String. Different separators can be set instead of comma. No error message can happen. Also, defines a view helper field receives a formatted string collection value.

There are two modes of behaviour for conversion, depending on the type of form field.

Validation Annotation Usage
Form field type Mode Description
String array or collection Auto conversion Converts directly from request parameter of same name and creates and sets array or collection
String Pair conversion Converts single string field value to String array or collection field named by parsedFieldName

Other parameters

Other Parameters
parsedFieldName If not empty string, name of field to contain parsed value. Defaults to 'parsed' plus capitalised field name, such as 'parsedLimit'. Only applies for pair conversion.
separator Separator between text. Defaults to ','.
trim Whether to trim whitespace from each entry using the trim function. Defaults to true.

When applied to a view helper field, StrutsMiscellaneousLibrary#updateDisplay formats from a source record field with the same name but only certain combinations are recognised.

Formatting Annotation Usage
Display field type Record field type Notes
String single value String array or collection
  • Element Details

    • parsedFieldName

      String parsedFieldName
      Default:
      ""
    • separator

      String separator
      Default:
      ","
    • trim

      boolean trim
      Default:
      true