The required converter requires a user to populate the field before the form can be processed. required takes a Boolean expression and affects only the set operation. You can use it in the following form tags:

dsp:input
dsp:select
dsp:postfield
dsp:textarea

If the value in a required field is an empty string or contains white space, a DropletFormException for this element is thrown.

For example, the following input tag creates a form exception if the user submits the form with a null or empty value in the input field for Person.userName:

<dsp:input type="text" bean="Person.userName" required="true"/>

Note:date and number converters take required as an optional attribute. For example, this tag specifies a date format, and makes the field required:

<dsp:input bean="NewUser.lastActivityDate" date="MMM d, yyyy" required="true"/>

 
loading table of contents...