Home > Guides > Core Developers Guide > Validation > conversion validator |

Apache Struts 2 Documentation
conversion validator
Edit Page Browse Space Add Page Add News

# Description

Field Validator that checks if a conversion error occured for this field.

# Parameters

- fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required

# Examples

# Repopulating Field upon conversion Error

The capability of auto-repopulating the stack with a fake parameter map when a conversion error has occurred can be done with 'repopulateField' property set to "true".

This is typically usefull when one wants to repopulate the field with the original value when a conversion error occurred. Eg. with a textfield that only allows an Integer (the action class have an Integer field declared), upon conversion error, the incorrectly entered integer (maybe a text 'one') will not appear when dispatched back. With 'repopulateField' porperty set to true, it will, meaning the textfield will have 'one' as its value upon conversion error.