Cannot get cookie from servlet after RequestDispatcher.forward()
843835Nov 26 2001 — edited Nov 26 2001Hi gurus, I have a servlet that add a cookie to the response object and call a second servlet by RequestDispatcher.forward(). Why this (second) servlet cannot get the cookie ? If I call /SecondServlet from browser or call it by sendRedirect() I can see the cookie. Thanks
FirstServlet
... response.addCookie(cookie);
... RequestDispatcher disp = httpservletrequest.getRequestDispatcher("/SecondServlet");
disp.forward(request, response);
SecondServlet // no cookie here ! Cookie acookie[] = request.getCookies();