Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Programmatically call the error page for a 500 error

Chris Hyzer

2005-02-18

Replies:

Hello,

This works in Tomcat 4, but not 5 (5.0.25)


response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

RequestDispatcher dispatcher =
request.getRequestDispatcher(somePage);

dispatcher.forward(request, response);


I would like to set a 500 error code, and call
different pages in different circumstances. Right now
it calls the default Tomcat 500 page. If I add an
error page in the web.xml it will call that. But I
need to programmatically decide, so I can have a 500
error go to various JSPs that communicate the problem.

Any ideas?
Thanks,

Chris

ps. I tried an error page that was just text, so the
error page is not triggering an error I believe... the
same code works fine in tomcat 4 (.1.28 I think)

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.