struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhang, Larry (L.)" <lzhan...@ford.com>
Subject RE: configure default error page in web.xml
Date Tue, 30 Sep 2003 20:09:29 GMT
I am thinking not to use struts.

I have this in my web.xml, but when there is an Exception in servlet, I couldn't see the error
page as expected. Did you guys have any luck to have this work?

Thanks.


<error-page>
  	<exception-type>java.lang.Exception</exception-type>
  	<location>error.jsp</location>
  </error-page>



-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: Tuesday, September 30, 2003 4:02 PM
To: Struts Users Mailing List
Subject: RE: configure default error page in web.xml


You can certainly combine approaches to let a Struts action handle pretty much
any exception in the app. In web.xml:

<error-page>
  <exception-type>java.lang.Exception</exception-type>
  <location>/do/error</location>
</error-page>

Where "/do/error" is obviously a Struts action mapping path.

Quoting Mike Jasnowski <mjasnows@bea.com>:

> It's too bad you couldn't forward that to an Action, which could then
> forward it to a custom page, or rethrow so a Struts exception handler could
> grab it.
> 
> -----Original Message-----
> From: Zhang, Larry (L.) [mailto:lzhang20@ford.com]
> Sent: Tuesday, September 30, 2003 3:13 PM
> To: Struts Users Mailing List
> Subject: configure default error page in web.xml
> 
> 
> HI,
> 
> I have a request to catch a Java Exception in the servlet and display an
> error page. The functionality requires that we display different error
> message for different exception.
> 
> A way to do this is to put try and catch logic in servlet, and if an
> Exception is caught, I do
> request.setAttribute("javax.servlet.jsp.jspExcetion",e), and then forward
> to
> jsp error page, where we check the type of exception implicit object. Based
> on this type, we display different error message. This is fine, but we are
> not going to use this approach.
> 
> The other way is to configure web.xml. We can configure an error page for
> specific Java exception. If the specific exception is raised to the web
> container, the configured error page will get called. My question is that
> is
> there any body  doing this way successfully?
> 
> Thanks.
> 
> Larry Zhang

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message