Matthias Brantner wrote:

> Hi,
>
> why can a SessionId be null, or why can a Session be invalid. I just
> created a Session (req.getSession(true)) and I wanted to get a Session
> Id (sessionId = req.getRequestedSessionId()). So, how can this Session
> be invalid. All Cookies are accepted.
> Thanx in advance.
>

You are not really asking the same question here.

"request.getRequestedSessionId()" asks the servlet container "what session ID
was requested in this request?"  The first time in, there won't be one, because
the browser does not know it needs to be in a session until you tell it (by
sending the cookie, or doing the appropriate URL rewriting).

To find out the session id of the session you just created, call
session.getId() instead.

>
> Matthias
>

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to