Answer the question
In order to leave comments, you need to log in
Servlet (Tomcat7) + HTML5/JS client: how to organize a session?
Hello!
I am making a client application in HTML5 / JS, on the server a servlet under Tomcat7.
It seems that when you press F5 in the browser and refresh the page, the session is not lost, but I have seen hints that it can.
Is it possible to rely on JSESSIONID? Or is it better to do something else?
Thank you.
Answer the question
In order to leave comments, you need to log in
There are two ways to organize a session (at least known to me):
1. Through a cookie (jsessionid)
2. Through a request parameter (?jsessionid=4t34t34t34t3t)
Both methods work great and no problems were observed for people (including EE customers ) ).
What exactly is the fear?
The session on the server is determined either by the presence of jsessionid in the request cookie or in the url. There is no other way (well, or it will be your own jsessionid).
If the browser does not support cookies (experienced browsers on some phones) and/or cookies are disabled, then the browser will not pass the JSESSIONID cookie accordingly. In this case, you can pass the session ID to the url: host :port/path?query;jsessionid=<session ID>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question