Vasu,
Well the ServletConfig object is an implicit object in the service
method so don't have to create it... what you can try to do is ... instead
of instantiating ServletConfig and ServletContext.. try
//////////////Code Servlet 1 - service() method//////////
response.setContentType("text/html");
PrintWriter out = response.getWriter();
getServletConfig().getServletContext().getRequestDispatcher("/examples/servl
et/HelloWorldExample3").forward(req, resp);
out.flush();
//////////////End Code///////////////
this will work ..
-----Original Message-----
From: Vasu Y [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 08, 2000 2:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Servlet-to-Servlet Communication
Revathi,
I tried RequestDispatcher.forward(request, response), but doesn't work.
The following is the code I tried on Tomcat 4.
Both the servlets are deployed on the same machine.
Can u tell me if I'm missing something....
//////////////Code Servlet 1 - service() method//////////
response.setContentType("text/html");
PrintWriter out = response.getWriter();
ServletConfig config = getServletConfig();
ServletContext context = config.getServletContext();
RequestDispatcher dispatcher =
context.getRequestDispatcher("//examples//servlet//HelloWorldExample3");
dispatcher.forward(request, response);
out.flush();
//////////////End Code///////////////
//////////////Code Servlet2 - service() method//////////////
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Hello World Servlet Three");
//////////////End Code///////////////
Thanks,
Vasu
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html