Creating servlets

The servlet wizard helps you create Java™ servlets by walking you through the creation process and by providing you with output files that you can use or that you can modify for use with your Web application. The servlets can run on Java EE-compliant Web servers.

To create a servlet, complete the following steps:

  1. From the Java EE perspective, expand your dynamic project in the Project Explorer view.
  2. Right click on the Servlet icon, and select New > Servlet from the pop-up menu. The Create Servlet wizard appears.
  3. Follow the project wizard prompts.

General Information

Modifiers
You can select a modifier in the wizard to specify whether your servlet class is public, abstract, or final. Note that classes cannot be both abstract and final.
javax.servlet.Servlet
Although javax.servlet.Servlet is provided as the default interface, you can use the wizard to add additional interfaces to implement.
Interface selection dialog
This dialog appears if you elect to add an interface to your servlet. As you type the name of the interface that you are adding, a list of available interfaces listed in the Matching types list box updates dynamically to display only the interfaces that match the pattern. You should choose an interface to see the qualifier, and then click OK when finished.
Method stubs
You can select any appropriate method stubs to be created in the servlet file. The stubs created by using the Inherited abstract methods option must be implemented if you do not intend to create an abstract servlet. Note that this is not true for Constructors from superclass
Related concepts
Servlets