If a user leaves a form field empty, by default the ATG platform does not call the setX method to change the value of the corresponding property. For example, your site might have a form where registered users can update their profiles, and includes a text field for entering a new home address. If the user leaves this field blank, the property that stores the address remains unchanged.

In some cases, you might want a blank form field to indicate that the corresponding property should be set to null. You can set the nullable converter to an expression of true to do this. For example:

<dsp:input type="text" bean="Person.address" nullable="true"/>

Primitive data types (such as int) , however, cannot be set to null. If you use the nullable converter with a property whose data type is a Java primitive, and the user leaves the field empty, an exception is thrown. You should use the nullable converter only with data types that are classes (such as Integer).

Like the required converter, the nullable converter can be used in conjunction with the date and number converters. For example, this tag specifies a number format, and makes the field nullable:

<dsp:input bean="NewUser.age" number="#" nullable="true"/>

loading table of contents...