Use the propertyExceptions property to determine which form handler properties have exceptions associated with them, and to display a message near each field where an exception occurred. In the following example, the form includes a field where users are required to enter an email address. If no email address is entered, an exception is thrown and the error code for that exception is missingRequiredValue—the error code commonly used by form handlers when a required field is empty. The Switch bean renders the missingRequiredValue open parameter, which displays an error message immediately below the field.

<p>Email address:
<dsp:input bean="MyFormHandler.value.email" size="32" type="text"
required="true"/>
<dsp:droplet name="Switch">
  <dsp:param bean="MyFormHandler.propertyExceptions.email.errorCode"
    name="value"/>
  <dsp:oparam name="missingRequiredValue">
    <br/>You must provide an email address.
  </dsp:oparam>
</dsp:droplet>

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices