O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

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

The Shopping Cart Bean

The shopping cart bean shown below encapsulates the business processing necessary to maintain the user's shopping cart. The bean contains not only the get and set methods for the shopping cart contents but the addMovies method, used to add a collection of movies to the shopping cart, and the deleteMovies method, which allows a collection of movies to be deleted from the shopping cart.

The ShoppingCartBean uses an internal DAO and value object to manage the shopping bean state. A getItemCount method is used to return the count of items in the shopping cart, used by one of the action classes to determine whether or not the cart is empty. (In Chapter 35 we examine how to implement this as an EJB.)

The ShoppingCartBean Class ...

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