Hi,

If I remember correctly, forward will only work for a "relative" URL. So, in
your case, you may want to use something like (you may have to modify the
url to fit your needs!):

RequestDispatcher myDispatcher =
getServletContext().getRequestDispatcher("../../examples/servlet/HelloWorldE
xample3");
myDispatcher.forward(request, response);

Also, check which exception you are getting, that's really usefull to
understand what's wrong.

Hope That Helps!
Loic.
______________
Lo�c Fabro
/--------------------------------------------------\
Consultant, Advanced Services Group   | Simple to Use - Simple to Deploy -
Simple to Get |
MicroStrategy                         |  MicroStrategy 7 Business
Intelligence Software  |
The Power of Intelligent E-Business   |        Get your Free evaluation copy
today!      |
                                      |
www.microstrategy.com/eval           |
8000 Towers Crescent Drive
\--------------------------------------------------/
Suite 1400
Vienna, VA 22182



-----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



> "This message is for the sole use of the intended recipient and may
> contain confidential and/or privileged information.  Any unauthorized
> review, use, disclosure or distribution is prohibited.  If you are not the
> intended recipient, please contact the sender by reply email and destroy
> all copies of the original message.  Thank you for your cooperation."
>

___________________________________________________________________________
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

Reply via email to