Java Reference
In-Depth Information
The following steps enter the code to override the servlet init() and destroy()
methods.
To Override the init() and destroy() Servlet Methods
1. Enter lines 20 through 42 as shown in Figure 12-16 on page 800.
TextPad displays the init() method for the servlet (Figure 12-17). The init()
method creates a new StockTrackerDB object, establishing a connection to
the database.
exceptions
caught,
producing
stack trace
and exiting
instance variable
creates new
StockTrackerDB
object
init() method
FIGURE 12-17
2. Enter lines 43 through 69 as shown in Figure 12-16 on the previous page.
TextPad displays the destroy() method for the servlet (Figure 12-18).
The destroy() method calls the StockTrackerDB close() method, closing
the database connection.
StockTrackerDB
close() method
exceptions
caught,
producing
stack trace
and exiting
destroy()
method
FIGURE 12-18
 
Search WWH ::




Custom Search