Download
FAQ History |
API
Search Feedback |
Initializing a Servlet
After the Web container loads and instantiates the servlet class and before it delivers requests from clients, the Web container initializes the servlet. To customize this process to allow the servlet to read persistent configuration data, initialize resources, and perform any other one-time activities, you override the
init
method of theServlet
interface. A servlet that cannot complete its initialization process should throwUnavailableException
.All the servlets that access the bookstore database (
BookStoreServlet
,CatalogServlet
,BookDetailsServlet
, andShowCartServlet)
initialize a variable in theirinit
method that points to the database access object created by the Web context listener:
Download
FAQ History |
API
Search Feedback |
All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.