Java Reference
In-Depth Information
<title>Sams Movie Catalog</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1”>
<body bgcolor=”#FFFFFF”>
<table width=”100%” border=”0”>
<td colspan=”2”><jsp:include page=”titlebar.jsp” flush=”true” /></td>
<td width=”75”><%@ include file=”navigation.jsp” %></td>
<td valign=”top” >
<div align=”center”><b>Thanks for shopping with Sams</b></div>
You now have an idea as to what the site will look like, so we will add the functionality to
make it work. The first steps in doing this are adding the necessary service classes that include
the business logic. You will be adding four services. Each of these classes will implement the
Service interface. The following sections describe each of these classes and where they fit into
your Web application. As you look over these implementations of the Service interface, notice
how simple it is to add new functionality to the Web application.
The ListMovies Service
The most important part of the ListMovies class is its implementation of the
Service.execute() method. This is where all of its major functionality exists. The execute()
method starts its execution when a user selects a category from navigation.jsp , which lists
all of the categories found in the catalog. When its execution starts it gets the category ID
from the request and performs a select statement on the Titles table, returning a ResultSet
containing a list of movies with the chosen category ID. When the ResultSet is returned it is
converted into an array of HashMaps and put back on the request to be iterated over by the
named target, which in this case is the previously listed ListMovies.jsp . The source for
ListMovies is in Listing 20.9.
Search WWH ::

Custom Search