Java Reference
In-Depth Information
L ISTING 22.1
Continued
if ( pool != null ) {
// empty the pool
pool.emptyPool();
// Remove the Attribute from the ServletContext
context.removeAttribute(“TRADER_POOL”);
}
else {
22
System.err.println(“Could not get a reference to Pool!”);
}
}
}
The only change from the ConnectionPoolServlet found in Chapter 7 is the name of the
servlet. The URL has been changed to point to the trader data source, and the number of con-
nections has been set to two. Make sure you also add the following code snippet to the trader's
web.xml file:
<servlet>
<servlet-name>TraderConnectionPool</servlet-name>
<servlet-class>TraderConnectionPool</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
This snippet preloads the TraderConnectionPool when the Tomcat engine starts up.
Views
Now you need to define the interface with which your users will interact. From the require-
ments defined in the first section of this chapter, you will need to create four views and an
error page.
Trader Layout
Each of these pages, excluding the error page, will have the basic layout shown in Figure 22.1.
As you can see, the trader layout has three basic parts. Starting from the top is the Title Bar,
where you see a simple graphic of the Sams logo plus an HTML stock quote form, which will
display the latest pricing for an entered stock symbol. This Title Bar will be at the top of all of
your Views and will be represented by the titlebar.jsp page. Figure 22.2 shows an image of
the real contents of the Title Bar.
 
Search WWH ::




Custom Search