****** Read API:
 
getSession
 public abstract HttpSession getSession(boolean create)
Gets the current valid session associated with this request, if create is false or, if necessary, creates a new session for the request, if create is true.

Note: to ensure the session is properly maintained, the servlet developer must call this method (at least once) before any output is written to the response.

Additionally, application-writers need to be aware that newly created sessions (that is, sessions for which HttpSession.isNew returns true) do not have any application-specific state.

Returns:
the session associated with this request or null if create was false and no valid session is associated with this request.
Steve
 
-----Original Message-----
From: John Reynolds <[EMAIL PROTECTED]>
To: Java Apache Users <[EMAIL PROTECTED]>
Date: Wednesday, May 19, 1999 10:43 PM
Subject: Re: Session Tracking problem

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);
 
 

Note that IE 5 seems to be able to keep the session alive, but Netscape 4.51
cannot!  And I do *not* have Netscape cookies turned off....

I have the exact same problem and would like to ask some questions.
should ' session.putValue("login.target", "target address"):' be put in the Set-Cookie string with JServSessionId and path (got from the logs).  It doesn't seem to be but works ok with IE5.
[Note I am trying to do Jason Hunters examples]

Tried Craig's suggestion of shifting the setContentType without success (on Netscape).

Whats the difference between using PrintWriter and ServletOutputStream ?

John
 

-- 
==============================================================================
"There are no kernel hackers in Ireland. They spend all their time in the pub"
Alan Cox
==============================================================================
 

Reply via email to