Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java
Expertise: Beginner
Dec 4, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Tracking Session Information When Cookie Is Disabled

What is the simplest way to keep track of session information if the cookie is disabled in the client? Even though we have other alternative solutions like passing the session ID in the query string or passing the session ID through a hidden variable, the simplest way is to encode the URL with the session ID. Wherever the URL is used, use the following syntax to encode the URL, then display or store it. The usage is:
<%= HttpServlet.response.encodeURL("/URL here") %>.
Incase of redirecting the page, the syntax is
<%= HttpServlet.response.encoderedirectURL("/URL here") %>

Now, in your JSP or servlet, you can retrieve the session ID and perform the calculation respective to the client.
Krishnan VR
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date