Head First Servlets and JSP (Basham, Sierra, Bates): best for beginners, very visual, and good for exam prep. It’s older, but the fundamentals are unchanged.
Murach’s Java Servlets and JSP: clear, practical, with full examples. Good for building real apps.
Core Servlets and JavaServer Pages (Marty Hall): detailed reference. Free tutorials are at coreservlets.com.
Jakarta EE Tutorial (free, official): up to date for the current spec
Different browsers, devices or incognito windows: each gets its own JSESSIONID cookie, so the same user can have several sessions at once. This is automatic.
Same browser: all tabs share one HttpSession per web app, because they share the cookie.
Simulating several sessions in one browser: store separate data under different keys, for example session.setAttribute("cart_" + tabId, cart).
Tracking a user’s sessions: keep a Map<String, List<HttpSession>> and update it with an HttpSessionListener or HttpSessionBindingListener.
Limiting to one session: on login, find the user’s old session in that map and call invalidate().
Anubhav 13/11/2024 in IT Courses/Java/Servlet
Which is a good refrence book for Servlets and JSP?