Quick question....do you really want the user to see a SQLException message?

Assuming that is really what you want, there are constructors for AE that
take a key and up to four objects that will be substituted in the error
value that is specified for the key.  The key and value appear in
ApplicationResources.properties.  So you could do the following in your
action:
catch (SQLException e)
{
        ActionErrors errors = new ActionErrors();
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("sql.exception",
e.getMessage()));
        saveErrors(request, errors);
        return mapping.findForward("systemexception");
}


and then have this entry:
sql.exception=A database access error occurred.  {0}

The error message should then have the exception's message appear in it in
your error page.

Hope this helps



> -----Original Message-----
> From: ROSSEL Olivier [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 25, 2003 9:03 AM
> To: '[EMAIL PROTECTED]'
> Subject: Reporting an Exception message in a JSP.
>
>
> I want to display the error message of an SQLException
> in my JSP.
>
> At first, I tried to set an ActionError with this message and
> to display it via <html:errors/>.
> It does not work because ActionError accepts as an input
> string the key of a property.
>
> So what's the nicest way to show to the user the error message
> that I get from my SQLException ?
>
>
> ---cut here---
>
>
> This e-mail is intended only for the above addressee. It may contain
> privileged information. If you are not the addressee you must not copy,
> distribute, disclose or use any of the information in it. If you have
> received it in error please delete it and immediately notify the sender.
> Security Notice: all e-mail, sent to or from this address, may be
> accessed by someone other than the recipient, for system management and
> security reasons. This access is controlled under Regulation of
> Investigatory Powers Act 2000, Lawful Business Practises.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to