Well,

in fact there are three ways to use getSession(), a 'default' one
plus a method that takes a boolean as input indicating whether
to explicitly create a Session or not. Normally, one would use
the default implementation (getSession()). This will either return
a reference to the Session if one already exists, _or_ create a
new one and return a reference to that (lic: Singleton pattern).
In both cases, after calling getSession(), a valid Session instance
should exist. If you pass an additional boolean parameter to
this (overloaded) method, you can control session creation
behavior on your own. So if you just want to check if a request
already belongs to a Session, you pass 'false' and then check
for null being returned (or the other way round). If you want
a new Session to be explicitly created each time, you pass
'true'. You can easily get these details from the API docs,
just to note.

HTH,

-- Chris (SCPJ2)

NB. I said I never tried, but looking for JSESSIONID (still
wonder if this is correct, could be some '_' goes some-
where; but then, I might be mixing this up with form-based
login) would be my first approach for session-enabling
the GUI thing. Thought I made that somewhat clear
before. Didn't I?

> -----Original Message-----
> From: A mailing list about Java Server Pages specification
> and reference [mailto:[EMAIL PROTECTED]] On Behalf Of
> Evan Wright, iLabs Inc.
> Sent: Tuesday, February 04, 2003 11:39 AM
> To: [EMAIL PROTECTED]
> Subject: Re: HttpClient to Servlet
>
>
> Create a session object the first time the client connects
> (log in) with
> getSession(true) and each subsequent getSession(false) would
> return that
> object. (?)

[CLIP]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to