We wrap errors in our own exception class, and store them in our request/session.
Then redirect the user to a standard error page that knows how to retrieve the
error from the request/session, and display it in a 'friendly' way to the user.
Our exception class contains a user message, as well as the actuall error.  The
standard error page displays the user message with a link to an 'error details'
page that displays the actual error, stack trace, etc (for developers, admins,
etc).

This allows your errors to be localized as well.  :)

Pete

Maya Muchnik wrote:

> Thank you.
> I thought, that some struts "magic" I can use. If I will use a standard
> "errorPage" as you suggest, I will lose all pluses of the good struts
> interface.
> Maya
>
> Jean-Noël Ribette wrote:
>
> > ----- Original Message -----
> > From: Maya Muchnik <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, February 27, 2001 5:07 PM
> > Subject: struts-example - handle of ServletException
> >
> > > Hi,
> > > Do you have any ideas how registration.jsp file (struts-example) can be
> > > changed to handle a situation when a user call it directly. I do not
> > "like" a
> > > SevletException to be displayed:
> > >
> > > Error: 500
> > > Location: /struts-example/registration.jsp
> > > Internal Servlet Error:
> > >
> > > javax.servlet.ServletException: No bean found under attribute key
> > > registrationForm.....A LOT OF ERRORS MESSAGES
> > >
> > > It is better to display some "friendly" error message or return to
> > login.jsp.
> > >
> >
> > Hi Maya,
> >
> > You can specify a defaut error page in case you get a exception in your page
> > using the <%@ page errorPage="myErrorPage.jsp" %> tag. If an error occurs in
> > the JSP, the user is send to this page. Have a look at the jsp spec for more
> > details.
> >
> > Jean-Noël
begin:vcard 
n:;
x-mozilla-html:FALSE
org:<BR><IMG SRC="http://www.irista.com/logo/irista.gif"><BR><BR><FONT Color=#000080><FONT SIZE=2><B>Bringing Vision to Your Supply Chain
adr:;;;;;;
version:2.1
end:vcard

Reply via email to