You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Denis Shurtleff <dc...@draper.com> on 2002/06/17 15:51:13 UTC

I get a 404 when using requestDispatcher (using Tomcat-4.0.2)?

Howdy,

        I have 2 servlets, that I can access, in the same webapp:

/app/switch
/app/panel

with web.xml defined as:

<!doctype ... >

<web-app>

    <servlet>
        <servlet-name>SwitchServlet</servlet-name>
        <servlet-class>adminForms.Switch</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>PanelServlet</servlet-name>
        <servlet-class>adminForms.Panel</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>SwitchServlet</servlet-name>
        <url-pattern>/switch</url-pattern>
    </servlet-mapping>
    
    <servlet-mapping>
        <servlet-name>PanelServlet</servlet-name>
        <url-pattern>/panel</url-pattern>
    </servlet-mapping>

    <session-config>
      <session-timeout>30</session-timeout>    <!-- 30 minutes -->
    </session-config>
 
</web-app>

So, yeah, I can access both /app/switch and /app/panel.
Great. But inside switch, based on some form input, I redirect 
the request to panel using:

private void redirectRequest
        (String address, HttpServletRequest request, 
        HttpServletResponse response) 
    throws IOException, ServletException{
        RequestDispatcher rd = 
            getServletContext().getRequestDispatcher
            (address);
        rd.forward(request, response);
    }

Just like every tutorial says. But instead of getting
panel output I get the default 404 error:

<html><head><title>Apache Tomcat/4.0.2 - Error report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> </head><body><h1>Apache Tomcat/4.0.2 - HTTP Status 404 - /app/panel</h1><HR size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> <u>/app/panel</u></p><p><b>description</b> <u>The requested resource (/app/panel) is not available.</u></p><HR size="1" noshade></body></html>

Any pointers as to what I might be doing wrong?
Sorry if I'm retreading old tracks, but I didn't see anything 
like this in the archives and it doesn't make sense.

Deployment sequence:
$/export/app/tomcat/bin/shutdown.sh
$ant all
$ant deploy
$/export/app/tomcat/bin/startup.sh

System info and stuff, if it matters:
tomcat: 4.0.2
jvm: Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
os: solaris 2.8

Thanks,

-Denis Shurtleff

Programmer/Integrator
Charles Stark Draper Labs


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>