The exception taglib, AxKit::XSP::Exception, is used to catch exceptions. The syntax is very simple: rather than allowing different types of exceptions, it is currently a very simple try/catch block. To use the exceptions taglib, the following has to be added to httpd.conf:
AxAddXSPTaglib AxKit::XSP::Exception
Then you can implement form validation using exceptions, as Example E-6 demonstrates.
<xsp:page xmlns:xsp="http://apache.org/xsp/core/v1" xmlns:param="http://attic.apache.org/projects/axkit.html/NS/xsp/param/v1" xmlns:except="http://attic.apache.org/projects/axkit.html/NS/xsp/exception/v1" language="Perl" > <page> # form validation: <except:try> <xsp:logic> if ((<param:number/> > 10) || (0 > <param:number/>)) { die "Number must be between 0 and 10"; } if (!<param:name/>) { die "You must supply a name"; } # Now do something with the params </xsp:logic> <p>Values saved successfully!</p> <except:catch> <p>Sorry, the values you entered were incorrect: <except:message/></p> </except:catch> </except:try> </page>
The exact same try/catch (and message) tags can be used for sendmail and for ESQL (discussed in a moment).
 
Continue to: