Mike Varley wrote:

> I am trying to use the session tracking API with JServ, but have run
> into a problem in that sessions don't get tracked properly.  I can run
> the servlets on the Java Web server and they track perfectly.
>
> But I don't want to use the JWS. :)
>
> Basically, when I go to new pages, the HttpSession session =
> req.getSession(false) always returns null; using (true) means I get a
> new session ID on every page.
> here is the code at the top of all my doPost(req, res) methods:
>
>   res.setContentType("text/html");
>   ServletOutputStream outPut = res.getOutputStream();
>   HttpSession session = req.getSession(true);
>

You might try changing the order of these calls to:

    HttpSession session = req.getSession(true);    // Or false
    res.setContentType("text/html");
    ServletOutputStream outPut = res.getOutputStream();

That way, you're guaranteed to have asked for the session ID cookie to be
included, because you have done nothing that could possibly generate any output
beforehand.

Craig McClanahan




-- --------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
READ THE FAQ!!!!     <http://java.apache.org/faq/>
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to