title: how and when to create a session for anonymous user in jsp or struts2?
body: <p>I am confused a little as what should be my approach, Working on a design of shopping cart and i need to store shopping cart either in session or in database but not sure which approach would be best.here are the use case</p>
  
  <p>User is not logged in and adding product to cart (Anonymous user)
  User is logged in and adding product to cart.</p>
  
  <p>Our ShoppingCart is being saved in database and and every update/ edit in ShoppingCart is being updated in database.</p>
  
  <p>Now I need to take care about creating an anonymous customer and than assign this cart to that customer so that add to cart and well checkout can be associated with this customer.</p>
  
  <p>Can anyone suggest me what can be the right way to go for this?</p>
  
  <p>Should I create one anonymous user in database and use it every time a request for new customer (anonymous ) is being created.
  Place that user in current user session.
  Perform any operation on cart with respect to the current session.</p>