Thanks Kris, This works fine if the error page is another Tomcat context, but I was wondering if there was an elegant way to set this up in the httpd.conf or server.xml, without the need for an error-handling jsp to do the rerouting.
I will probably just go that route, since it won't be difficult to write, but further ideas are appreciated. Michael Mendelson In Town Consulting, LLC www.intowndenver.com > -----Original Message----- > From: Kris Schneider [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 03, 2003 7:18 AM > To: Tomcat Users List > Subject: Re: reference to external error-page > > > Well, you can't do it directly with an error page, the <location> > element's body > is required to contain an application-relative resource. Since you're using TC > 4.x, you could take adavantage of JSTL to do something like: > > web.xml: > <error-page> > <error-code>404</error-code> > <location>/error/404.jsp</location> > </error-page> > > /error/404.jsp: > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> > <c:import url="/error/404.html" context="/otherContext"/> > > This is equivalent to using the following in a servlet: > > ServletContext foreign = getServletContext().getContext("/otherContext"); > RequestDispatcher rd = foreign.getRequestDispatcher("/error/404.html"); > rd.include(request, response); > > So, the error page is still part of the app, it just imports a > foreign resource > to display the error message. Will that work for what you want to do? > > Quoting Michael Mendelson <[EMAIL PROTECTED]>: > > > > > Hello all, > > > > I would like to use an error page for certain apache/httpd errors as well > > as > > tomcat errors (e.g. 404). In the web.xml file though, the directive... > > > > > ---------------------------------------------------------------------- > ---------- > > <error-page> > > <error-code>404</error-code> > > <location>/error/404.html</location> > > </error-page> > > > ---------------------------------------------------------------------- > ---------- > > > > ...routes me to http://localhost/projectname/error/404.html. > > > > How would I route to an error page location that might be on the same > > server, > > but external to the project? > > > > I'm using Apache 1.3.23 and Tomcat 4.1.18 (and mod_jk to route requests to > > tomcat), if it matters. > > > > Thanks, > > > > Michael > > > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > -- > Kris Schneider <mailto:[EMAIL PROTECTED]> > D.O.Tech <http://www.dotech.com/> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
