Java Reference
In-Depth Information
FIGURE 12-43
Figure 12-44 displays lines 576 through 613 of the WebStocks servlet code.
The addUser() method on line 576 obtains data for a new user from parameter
values entered as input to a form (lines 580 through 586). Because all parameter
data are returned as Strings, user fields of other data types are created and their
values determined from the corresponding parameters (lines 588 through 602).
A new User object is created (lines 604 and 605), and the password for the new
user is set as expired, forcing the user to change the password upon the first use
(line 606). Only the call to the data access class method, addUser(), actually
affects the database, and so it is placed within a block of code synchronized on
the StockTrackerDB object (line 610).
FIGURE 12-44
(continued)
 
Search WWH ::




Custom Search