Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes how can i use session with out using cookie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how can i use session with out using cookie" Watch "how can i use session with out using cookie" New topic
Author

how can i use session with out using cookie

yogesh srinivasan
Ranch Hand

Joined: Jun 08, 2007
Posts: 55
how can i create/use session with out using cookie
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You can use URL rewriting. HttpServletResponse.encodeURL() will add a session ID to the URL.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Paul Sturrock is right. To explain it furthur use the response.encodeURL() with every page link that you are sending as a response.
E.g.

now what will happen is that your server will add a query string on the URL like this


In this way you will be able to recognize the requests coming from same clients. The server will manage this automatically i.e. it will automatically create a session based on the session ID provided in the query string.

Remember you must wrap each link that you send to the client where you want the session to remain alive. If any link is not encoded, clicking on that link will end that session.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i use session with out using cookie
 
Similar Threads
cookies and JSESSIONID
Session and cookies
transfer from jsp to servlet
Unable to get authentication and authorization working.
Using common-httpclient 2.0 with axis 1.2 beta