Servlet Basics
A good way to introduce servlets is to compare them to their more familiar counterparts—applets. A servlet is to a Web server what an applet is to a Web browser. An applet is a small Java program that is run by a Web browser via a simple, standard API. A servlet is a small Java program run by a Web server via simple, standard API. Table 9.1 compares the applet API to the servlet API.
Applet Class API | Servlet Interface API | Life Cycle |
---|---|---|
init() | init() | Called Once |
start(), stop() | service() | Called Many times |
Destroy() | destroy() | Called Once |
getAppletInfo() | getServletInfo() | |
getAppletContext | GetServletConfig() |
The applet API and servlet API are conceptually identical. Notice in the life cycle column ...
Get XML Development with Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.