O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Anatomy of a Servlet

As you just saw in the HelloWorldServlet, a servlet is a Java class that implements a few important methods. You can choose to implement these methods yourself or create a subclass of an existing servlet class that already implements these methods. The Servlet interface defines the methods that are required for a Java class to become a servlet. The interface definition is shown in Listing 13.2.

Code Listing 13.2. The Definition of the Servlet Interface
 package javax.servlet; public interface Servlet { public void destroy(); public ServletConfig getServletConfig(); public String getServletInfo(); public void init(ServletConfig config) throws ServletException; public void service(ServletRequest request, ServletResponse ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required