0 Replies Latest reply on Jan 18, 2004 10:46 PM by null null

    Dispatching a request from 1 servlet to another not working

    null null Newbie

      I am using JBoss3.2 with Apache 4.1, in my application i have 2 servlets which are present in different packages.
      The web.xml file have this thing

      <servlet-name>Servlet1</servlet-name>
      <display-name>Servlet1</display-name>
      <servlet-class>test.Servlet1</servlet-class>
      <load-on-startup>0</load-on-startup>

      The above is the main servlet through where all request are handled.
      For other special servlet i have this mapping

      <servlet-name>Servlet2</servlet-name>
      <display-name>Servlet2</display-name>
      <servlet-class>test.special.Servlet2</servlet-class>
      <load-on-startup>0</load-on-startup>


      Also i have mapped the following in the web.xml for the Servlet1 so that it can handle the request with context as "testing"
      <servlet-mapping>
      <servlet-name>Servlet1</servlet-name>
      <url-pattern>/testing</url-pattern>
      </servlet-mapping>

      Servlet1 works properly and handles the request coming from the context "testing". Now supppose i want to dispatch the request on special cases to "Servlet2" from "Servlet1" how i do that, the RequestDispatcher object from the Request object is not able to identify the "Servlet2".
      Do i have to say like request.getRequestDispatcher("Servlet2"), i have tried that but doesnt works?I have also tried to add a "/" before "Servlet2"but doesnt works?

      What can be the problem?

      Thanks