On 12/01/2010 09:00, Peter Chen wrote:
Hi, all

I am using Tomcat 5.5.26 as the Web Server. I know the session
information is stored in Cookies with the key JSESSIONID.

Only the id is stored in the cookie.

But some browsers don't support Cookies.

So my question is if user's browser doesn't support Cookies, then where
to store user's session information?

In the URL.

If you encode every URL on the page then Tomcat will determine whether there's a cookie and it will rewrite the URL to include the parameter "jsessionid".

 <a href="<% response.encodeURL('/path/to/page.jsp') %>">Link text</a>

An encoded URL will look like this:

 server.com/path/to/page.jsp;jsessionid=0000000?some=param&goes=here


Some frameworks (e.g. Struts) provide a tag library to do this which can make your HTML much more readable. It's not complicated to write your own though, if you don't want to use a framework.

 <html:a href="/path/to/page.jsp">Link text</html:a>


And besides session, how to store other user's state information,
because HTTP protocol is a stateless protocol?

In a database?


p


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to