Passing object between servlets

Discussions

Web tier: servlets, JSP, Web frameworks: Passing object between servlets

  1. Passing object between servlets (1 messages)

    How to pass object from sevlet in domain A, to another servlet in domain B??

    It is call servlet chaining, but can it be done on netscape application server 4???
  2. Passing object between servlets[ Go to top ]

    use request dispatching. Its an API in JSDK 2.1.
    The objects you are trying to pass should be in the first
    servlets request object, then after the request is dispatched interrogate with the second servlet.
    something like this

    RequestDispatcher dispatch = getServletContext().getRequestDispatcher(HOME_JSP);
    dispatch.forward(request, response);

    when you do this the first servlet is giving up its response object so terminate the first servlet with a return; otherwise you will try and write to a response object twice.
    rjb