title: How can I manage sessions in Java EE?
body: <p>In my Java EE application, I have a problem with sessions.  Different users can login to the application and the specified user can see the data for which he is authorized.  He should not be able to see other user data.  To differentiate users,  we are using <code>Client_ID</code>.  As soon as the user logs in we are fetching this <code>Client_ID</code> from the database and setting it in session like this:</p>
  
  <pre><code>session.setAttribute("Client_ID",user.getClient_ID())
  </code></pre>
  
  <p>We access this session value throughout the application and fetching the relevant data to that <code>Client_ID</code>.  This works fine when users work on a single browser, but the problem is this: </p>
  
  <p>Suppose there is a SuperAdmin, who needs to look all the clients under him.  SuperAdmin logs in as <code>client_1</code>, and again as <code>client_2</code>.  SuperAdmin has logged in both times using the same browser.  When I refresh the <code>client_1</code> browser, I am seeing the <code>client_2</code> details, which should not happen. </p>
  
  <p>I think our application is using the same session for two different logins in the same browser.  What would be solution for this problem?  I should see the correct data for the particular client when I refresh the page.</p>