HTTP is a “stateless” protocol which means each time a client retrieves a Web page, the client opens a separate connection to the Web server and the server automatically does not keep any record of the previous client request.
server: Still there are following three ways to maintain session between a web client and web
A subsequent requests webserver can as from the client they can be recognized using the thing a unique session ID as a cookie to each received cookie. web client and for
This may not be an effective way because many time browser does not support a cookie, so I would not recommend using this procedure to maintain the sessions.
Hidden Form Fields
A web server can send a hidden HTML form field along with a unique session ID as follows:
<input type=”hidden” name=”sessionid” value=”12345″> Session Handling
This entry means that, when the form is submitted. The specified name and value are automatically included in the GET or POST data. Each time when the web browser sends a request back, then the session_id value can use to keep the track of different web browsers.
This could be an effective way of keeping track of the Session Handling but clicking on a regular (<A HREF…>) hypertext link does not result in a form submission, so hidden form fields also cannot support general session tracking.
You can append some server can associate that Session Handling identifier with data it has store extra data on the end of each URL that identity about that session files the session.
For example, with http://tutorialspoint.com/file.htm;sessionid=12345, the session identifier attached as sessionid=12345 which can access the web server to identify the client.
URL rewriting is a better way to maintain sessions and works for the browsers when they don’t support cookies. But here drawback is that. You would have generated every URL dynamically to assign a session ID through the page is simple static HTML page.
Session Tracking Example : Session Handling
<input type=”text” name=”uname”>
<input type=”submit” value=”go”><br/>
<a href=”second.jsp”>second jsp page</a>
String name=(String)session.getAttribute(“user”); out.print(“Hello “+name);