tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ann patil" <patil...@hotmail.com>
Subject RE: Problem: Calling Servlet From Servlet
Date Thu, 21 Sep 2000 09:53:48 GMT
Let me give you some details about the application so that you can help
me solve the problem.

1) I have created an application in server.xml.
<Context path="/login" docBase="webapps/urs/login" debug="9" 
reloadable="true" >
</Context>

2) I created servlets and placed in:
webapps/urs/login/firstservlet
webapps/urs/login/secondservlet

3) Compiled the servlet successfully and placed the class files in
webapps/urs/login/WEB-INF/classes/FirstServlet
webapps/urs/login/WEB-INF/classes/SecondServlet

4) I included servlet in urs/login/WEB-INF/web.xml.
web.xml

<web-app>
     <servlet>
        <servlet-name>
            Login
        </servlet-name>
        <servlet-class>
            Login
        </servlet-class>
    </servlet>

    <servlet>
        <servlet-name>
            ReLogin
        </servlet-name>
        <servlet-class>
            ReLogin
        </servlet-class>
    </servlet>

</web-app>

5) I can execute the servlets individually.
http://localhost:8080/login/servlet/FirstServlet
http://localhost:8080/login/servlet/SecondServlet

6) I executed the first servlet using url:
http://localhost:8080/login/servlet/FirstServlet

7) And included the below stated code in the FirstServlet to call the
SecondServlet:
RequestDispatcher rd = 
getServletContext().getRequestDispatcher("/SecondServlet");
rd.forward(req, res);

Question: Am I doing something wrong ? or is there anything else to be done 
before calling the second servlet.

Please help

Thanks

Ann



>From: "James Cook" <jimcook@iname.com>
>Reply-To: tomcat-dev@jakarta.apache.org
>To: <tomcat-dev@jakarta.apache.org>
>Subject: RE: Problem: Calling Servlet From Servlet
>Date: Wed, 20 Sep 2000 17:17:10 -0400
>
>1. What is the URL you are using to launch first servlet?
>
>2. If you access the ABC servlet, using a URL local to the first servlet's
>address, does the ABC servlet load? I'm talking about typing the URL for 
>the
>ABC servlet directly in the browser.
>
>jim
>
> > -----Original Message-----
> > From: ann patil [mailto:patilann@hotmail.com]
> > Sent: Wednesday, September 20, 2000 1:43 PM
> > To: tomcat-dev@jakarta.apache.org
> > Subject: Problem: Calling Servlet From Servlet
> >
> >
> > Can anybody please help me!!!
> >
> > I have written a servlet which after checking certain condition needs
> > to call/invoke another servlet.I have used :
> >
> > RequestDispatcher rd = getServletContext().getRequestDispatcher"/ABC");
> > rd.forward(req, res);
> > Where 'ABC' is the second servlet.
> >
> > When executed in the browser the first servlet is displayed but gives
> > 'Page not found' error at the time of invoking second servlet.
> >
> > 1) I am using JDK 1.2 and Tomcat 1.3.
> > 2) I have placed both the servlets in the same directory.
> > 3) Have included the servlet name and class file name in
> > 'WEB-INF/classes/web.xml.
> >
> > Is there any thing that I am missing.
> >
> > Please reply.
> >
> > Thanks
> >
> > Ann.
> >
> > 
>_________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at 
>http://www.hotmail.com.
> >
> > Share information about yourself, create your own public profile at
> > http://profiles.msn.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


Mime
View raw message