tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject How do I change servlet contexts???
Date Wed, 30 Jul 2003 22:55:53 GMT
Tomcat: 4.1.24

I have a war file whose base context is "/example". 
Within that context there is an HTTP servlet
(GuestServlet) with a servlet mapping that captures
everything under "/example/guest/*".  Within
GuestServlet.class I create a RequestDispatcher to
forward control to an HTML page (lookup.html) under
the base context (/example).  The problem is when
control is forwarded to /example/lookup.html it does
not work.  The context remains unchanged at
/example/guest and so it actually attempts to display
/example/guest/lookup.html when I need
/example/lookup.html.  I use the following code within to try and display lookup.html under
the base context /example.  Will someone please tell
me what I am doing wrong?

public class GuestServlet extends HttpServlet {


  protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
    RequestDispatcher rd = null;
    // Dispatch to next url
    ServletContext cntxt =
    rd = cntxt.getRequestDispatcher("/lookup.html");
    rd.forward(request, response);

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message