In the following example, the Switch servlet bean uses the form handler’s formError property to determine whether any errors occurred when processing the form. If this property is true, the form handler’s formExceptions property is passed to the servlet bean ErrorMessageForEach, which displays the message associated with each exception in the formExceptions vector.

<dsp:droplet name="Switch">
<dsp:param bean="MyFormHandler.formError" name="value"/>
<dsp:oparam name="true">
    <dsp:droplet name="ErrorMessageForEach">
      <dsp:param bean="MyFormHandler.formExceptions" name="exceptions"/>
      <dsp:oparam name="output">
      <dsp:valueof param="message"/>

Note: If your form handler is session-scoped, clear the formExceptions property after you display errors to the user.

loading table of contents...