Adding to the Shopping Cart

The page generated by the XSL transformation process is processed by the submit cart action. This is done because the controller servlet will map submitCart.do URL to this class based on the information we have entered in the Struts configuration file (struts-config.xml). As shown below, this class, run as a servlet, processes the list of movies selected as posted by the movies listing page. These movies are added to a collection that is added to the user's shopping cart by the shopping cart bean. If the user does not have a shopping cart, then an error message is logged and an exception is thrown. Since this action may optionally be used to delete movies from the user's shopping cart, there is logic here to provide ...

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.