Annotation Type IntegerCSVConversion
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 type of Integer and error message to display if this fails. Individual empty string values are converted to null. An entire empty string value is converter to an empty collection. Different separators can be set instead of comma. Also, defines a view helper field receives a formatted integer collection value.
There are two modes of behaviour for conversion, depending on the type of form field.
| Form field type | Mode | Description |
|---|---|---|
| String | Pair conversion | Converts string field value to Integer collection type field named by parsedFieldName |
| Integer collection type | Auto conversion | Converts directly from request parameter |
By default, messages are added to the actionErrors list but this can be overridden by messageType:
| ERROR | Message added to Action level error messages. Default. |
| FIELD | Message added to field error messages using same name as field. |
| MESSAGE | Message added to Action level info messages. |
| WARNING | Message added to Action level warning messages. |
Other parameters
| message | If not empty string, text message to display. Used if messageKey is empty string or finds no
message. |
| messageKey | If not empty string, message key to retrieve from Action's TextProvider. Uses message if no key
provided or no message found. |
| 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 numbers. Defaults to ','. |
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.
| Display field type | Record field type | Notes |
|---|---|---|
| String | Integer collection |
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescription
-
Element Details
-
message
String message- Default:
""
-
messageKey
String messageKey- Default:
""
-
messageType
Required.MessageType messageType- Default:
ERROR
-
parsedFieldName
String parsedFieldName- Default:
""
-
separator
String separator- Default:
","
-