Java Reference
In-Depth Information
Trader Requirements
You will need to create a Web application named Trader, following the steps in
Appendix A, “Web Applications and Configuring the Servlet Engine,” and make sure
you have the classes ConnectionPool , Controller , and Service in your Web applica-
tion's classpath.
In this chapter you are again going to put your newly found knowledge to practical use by cre-
ating a simplified stock trading system. This system will be based on the server-side imple-
mentation of the MVC as defined in Chapter 13 “A Servlet Controller.” The basic requirements
are defined as follows:
Get a Quote —The trader application must allow a user to enter a stock symbol and
receive corresponding last trade, bid, and ask prices.
Sell a Stock —The trader application must give the user the ability to enter a stock sym-
bol and an asking price for selling a stock.
Buy a Stock —The trader application must give the user the ability to enter a stock sym-
bol and a bid price for buying a stock.
For this example, we will not keep up with anything except the last committed trans-
action, nor will we have user accounts. All stock will be traded with integer pricing
only. This example is just to show how easy it is to extend an application using the
This section of the requirements defines the database representation of the trader application.
Only one object in the application will be modeled in the database—the stocks table. For our
purposes we will not build an object representation of the database. We will simply use SQL
and iterate over ResultSets .
The stocks object that will be represented in the database is the stock object itself. Each of the
stock object's attributes must be included in the table representation. Table 22.1 lists the
required elements needed to store a stock object.
Search WWH ::

Custom Search