(in my opinion etc)
In general you
should not use response.sendRedirect() to communicate directly between two servlets since this results in two sets of HTTP message being sent.
The client sends a request to servlet1, servlet1 decides not to handle the request and executes a sendRedierct("servlet2").
This sends a message back to the client saying "don't look to servlet1 one, look to servlet2 for the request (response code 302, moved temporarily)
The client changes the url it diplays to "servlet2" and sends another requst for the server for servlet2.
The correct way is to use the RequestDispatcher, which allows servlets to communicate within he servlet and share the same request and response objects.
In this manner, servlet1 can decide to forward to servlet2, but can place some data on the request using setAttribute() to pass onto servlet2...
If you look at the RequestDispatcher, there are two ways to get from one servlet (or
jsp) to another, include and forward.
include allows the data to be concatenated so that the page returned t the client can be built from several sources,
forward attempts to ignore the initial servlet output and require the next to provide the output.
In general I prefer
forward since the only effect servlet1 can have on the output is based on the data it places on the request. If it has attempted to set header data or write a HTML page this data is lost. (reduces confusion in servlet2 as to what or how much has already been done)
Dave.