If the user chooses to turn off their sessions for cookies you need to URL
rewritting, this is done by using
response.encodeURL(URL)

basically what URL rewritting does is change the URL to include a session
ID within it some where ie

http://fred.bloggs.com.au/fredspage.html

may become

http://fred.bloggs.com.au/fredspage.html?sessionid=XZXZX1234GDFSUE

the session id string is generated by the server you don't need to
know it. normally it would be in the cookie.

one problem is that you need to do this with every URL on your page !
As soon as the usesr takes a link that doesn't have rewriting on it you've
lost their session.

this is the same for servlets as for JSP you would do something like

<A href="<%= response.encodeURL("\fredspage.html")  %>">freds page</A>

as for detecting if the user is using cookies you can do it but there is no
need, just use the above on all your URLs and the server will decide
if the URL's need to be rewritten or not.

another way of doing it is to parse your HTML through some other
code that will rewrite the URLs for you (this is how I've done this
with some code I wrote, I can send it if anyone wants it)


Hope that helps

Alan Boldock
boldenterprise.com.au


----- Original Message -----
From: "Marc Krisjanous" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 17, 2000 11:34 AM
Subject: Session testing question


> Hi all,
> I have a shopping cart Servlet. The Servlet stores the shopping cart in
the
> session object and the JSP pages accesses the session shopping cart.  Now
> that I have completed the code I was thinking about the situation where
the
> client could deny cookies.  Now I have tested this on IE5 (disabling
cookie
> acceptance) and my Servlet does not work! It treats each session access as
> new. The question I have is:
>
> How can I check to see if cookies have been disabled and if so what can I
> use to still use the shopping cart?? I have heard of URL rewriting? Could
I
> use this instead of storing the shopping cart in the session object if
> cookies are disabled?
>
> Here is my infrastructure:
>
> 1.Websphere 2.x
> 2.JSP version 0.91
> 3.JDK 1.1.8
>
> Cheers
>
>
> Marc
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to