Java Reference
In-Depth Information
through some sort of fulfillment process. The source for the CheckOut service is in
Listing 20.12.
L ISTING 20.12
import Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext;
public class CheckOut implements Service {
public CheckOut() {
implemented method from Service interface
public void execute(HttpServletRequest request,
HttpServletResponse response,
ServletContext context) throws Exception {
// Check the HttpSession for an exist ShoppingCart
HttpSession session = request.getSession();
ShoppingCart cart = (ShoppingCart)session.getAttribute(“cart”);
if ( cart != null ) {
// If there was an existing cart empty it
Using the Online Catalog
In this section you will use the Catalog Web application. This is where you will see how pow-
erful a server-side implementation of the MVC is. Make sure you have completed the follow-
ing steps:
Create the Catalog Web application.
Set up the CatalogConnectionPool as described in the previous sections, including mak-
ing sure the ConnectionPool package is in your classpath.
Move all JSPs to the <SERVER_ROOT>/webapps/catalog/ directory.
Search WWH ::

Custom Search