title: How to differ sessions in browser-tabs?
body: <p>In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in the browser-tabs? 
  In this example: </p>
  
  <pre><code>&lt;%@page language="java"%&gt;
  &lt;%
  String user = request.getParameter("user");
  user = (user == null ? (String)session.getAttribute("SESSIONS_USER") : user);
  session.setAttribute("SESSIONS_USER",user);
  %&gt;
  &lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;
  &lt;%=user %&gt;
  &lt;form method="post"&gt;
  User:&lt;input name="user" value=""&gt;
  &lt;input type="submit" value="send"&gt;
  &lt;/form&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Copy this code in a jsp page (<code>testpage.jsp</code>), deploy this file in an existing context of a web application on the server (I use Apache Tomcat), then open a browser (FF, IE7 or Opera) using the correct URL (<code>localhost/context1/testpage.jsp</code>), type your name in the input and submit the form. Then open a new tab in the same browser, and then you can see your name (get from the session) on the new tab. Be careful with the browser-cache, sometimes seems that it doesn't happen, but it's in the cache, refresh the second tab.</p>
  
  <p>Thanks.</p>