title: java servlet remember me option with cookies
body: <p>I need to implement a simple remember me option in a java servlet with cookies, without using any advanced framework.</p>
  
  <p>First, at login, I create the cookie and send it in response to the browser (client). The value to be stored in the cookie is just a simple hash from username + password.</p>
  
  <p>How should I manage the incoming request from the browser, sending the cookie?
  My approach is to check between registered users if there is any user that has the hash from username + password equal to the value in the cookie?
  Is this approach correct?</p>
  
  <p>Also, I did not understand exactly what is the mechanism of the expiration date. Does the browser delete the cookie when it is expired, it not, how do I check if the cookie is expired?</p>