Refactoring the ShoppingCartBean

The ShoppingCartBean class is used by the action classes and servlets to interact with the user's shopping cart. The main purpose of this component is to provide a mechanism to add one or more movies to the shopping cart or to delete one or more movies from the shopping cart. The movies are selected for addition or deletion to the cart on the two HTML forms generated by the MoviesChooser servlet. These forms post to an action class, which compiles the user's selections in a collection that is used by the action servlet (SubmitCartAction) to call either the addMovies method or the deleteMovies method on the ShoppingCartBean.

We would like to refactor the ShoppingCartBean in a way that has a limited impact on the ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.