doGet/doPost issue
I have 2 servlets and i want to pass the request object(user input) of servletA to the request object of servletB. In other words just pass the request object from one servlet to another. So my code would look something like this.
class ServletAextends HttpServlet{
publicvoid doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ServletB servletB =new servletB();
//Would servletA request & response objects be now accessible in ServletB?
servletB.doGET(request, response);
}
}
Something tells me that this is a lousy way of doing things but I need the request object in ServletB for processing. Is this approach ok? If not any suggestions?
[1099 byte] By [
Robbie_Ca] at [2007-10-2 19:40:14]

hi,
i will show u with an example.
class servlet1 extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)
{
RequestDispatcher rd=req.getRequestDispatcher("/second");
rd.forward(req,res);
}
}
In the above example,/second is the URL-Pattern of second servlet
class
i hope u understand what i have written.
regards
hi,
Assume that are two clients X and Y . X is requesting SERVLET A and
Y is requesting SERVLET B. From SERVLET A the request is forwarded to SERVLET B. So, now there are two requests to SERVLET
B. As java supports multithreading, two threads are created one for
Client X request and one for Client Y . For each thread, there will be a service method running parallely . So, multiple requests are handled at a time.
So, combining doesn't take place
i hope u understand what i have written.
regards,