Hi , you mentioned do not let the first servlet set content. Why not ? What
does that affect? SC

In a message dated 10/24/2000 4:19:56 PM Eastern Standard Time,
[EMAIL PROTECTED] writes:

<< Hi,

 Use this method to direct your requests (not responses :-) ).

 ServletContext ctx = getServletConfig().getServletContext();
 RequestDispatcher disp = ctx.getNamedDispatcher("secondServlet");
 disp.forward(req, resp);

 furthermore,
 you can create a utlity class with method goToServlet and just pass it the
 required attributes and let it do the job.

 What this method does is forwards the request so that another servlet can
 take a look at it before sending it to the client. The request method is
 kept the same (i.e. it is Get if the servlet calling it has been called thru
 Get and Post if otherwise).

 Imp:
 a. Do not let the first servlet set the content type or get the output
 stream.
 b. The getNamedDispatcher is method of Servlet 2.2 API. Use the
 getRequestDispatcher for 2.1 but I could get it to work only for forwarding
 to JSPs not to servlets.

 I hope it answers your question.

 Thanks,
 tanmay >>

___________________________________________________________________________
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