[EMAIL PROTECTED] wrote:

> Well,
>
> all my servlets are on the same webapps.
> I don't use the url rewriting, but the HttpSession.
>
> for example in the first servlet:
> HttpSession session = request.getSession(false);
> if (session == null)
>  session = request.getSession(true);
> session.setAttribute("path1",request.getServletPath());
> RequestDispatcher dispatch =
> this.getServletContext().getRequestDispatcher("/servlet/chaining.Servlet2");
> dispatch.forward(request,response);
>
> in Servlet2
> HttpSession session = request.getSession(false);
> session.setAttribute("path2",request.getServletPath());
> RequestDispatcher dispatch =
> this.getServletContext().getRequestDispatcher("/servlet/chaining.Servlet3");
> dispatch.forward(request,response);
>
> I do the same in the third servlet, but when i test my session, it's  null.
>
> That's funny, but it only happen the first time i send the request, the
> second time, everything works fine !!!
> [...]

Hi :-)  I am not sure, is the following possibe?
in the first time, because you use getRequestDispatcher, so the new
cookie which includes "JSESSIONID" made by MyServlet1 "hasn't
got the time Yet to goto :-)" MyServlet2/3.

in the second time, that cookie(made by MyServlet1) has already been
"received" by the browser of your client, and re-sent to MyServlet1/2/3,
so now in MyServlet2/3, session is not null.


Bo
May.17, 2001


Reply via email to