O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filling and Spilling

One of the requirements from the FRD was that if the user quits his session and has items in the cart that should be remembered the next time the user logs in. In e-commerce parlance, this is called “filling and spilling” the cart.

To accomplish this, you need to be able to detect when the user's session has gone away. The Servlet specification refers to this as “session invalidation” and (luckily) offers an easy way to watch for it.

When you give an object session persistence (with useBean or manually with pageContext.setAttribute), you can take advantage of an interface provided by Tomcat called HttpSessionBindingListener. If an object implements this interface and is bound into a session, it will be notified via this interface ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required