Emanuele Tatti

Subscribe to Emanuele Tatti: eMailAlertsEmail Alerts
Get Emanuele Tatti: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Top Stories by Emanuele Tatti

Usually, in a rich internet application (RIA), a user with a registered account can do two different logins from two different workstations and can maintain two concurrent sessions opened. In some applications we want to limit the users to one session per account, so we have to take countermeasures. A simple method to check if a user is logged is to set a property in the current HttpSession; in this example in our login function we set session.setAttribute("username", username); If there is no username attribute, we will return an error to the user. When someone starts a session with his account we have to check if there is already a session opened with that account. We can use an HashMap using the username as key and the session as value; obviously we have to use the same hashmap across multiple logins. A very fast and simple solution is to create a singleton that exp... (more)