W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 2000

FYI: Sessions with JSP without cookies

From: Mark Woodruff <nothimtheotherguy@yahoo.com>
Date: Fri, 8 Dec 2000 16:21:05 -0800 (PST)
Message-ID: <20001209002106.17684.qmail@web5102.mail.yahoo.com>
To: www-jigsaw@w3.org
In case anyone is trying to use the URL-rewriting to
handle sessions for users without cookies, here's the
logic to do it. For each page, put this at the top:

// when this page is accessed for the first time,
redirect the
// user back to the page with the appropriate session
id appended
// (so that we can reference session variables from
here on in

   if (session.isNew())

      // could use HttpUtils.getRequestURL(request) in
place of
      // request.getRequestURI() if needed

For each reference within the page, you'll need a
response.encodeURL() call as well. For example, if you
want to reference the fred.html page inside your page,
you'd put:
    <a href="<%= response.encodeURL("fred.html")
%>">Fred's page</a>

You need to do this for *every* page and *every*
reference, but it works. Note that Jigsaw 2.1.2 isn't
compliant with the latest JSP specs, which require the
session variable to be JSESSION, I believe.

It feels nice when things work, doesn't it?


Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
Received on Friday, 8 December 2000 19:21:37 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:37 UTC