Creating a Servlet
See Also
When you create a servlet in the web application's src folder and
compile it, the IDE includes it in the web application's WAR file. When you
create the servlet using the following steps, the IDE compiles the class and
its package structure to the build/web/WEB-INF/classes folder.
To create a servlet source file:
- In the Projects or Files window, right-click the project's node and
choose New > Other
from the pop-up menu. The New File wizard appears.
- Under Categories, choose Web. Under File Types, choose Servlet. Click Next.
- Specify the fully
qualified class name, the location and the servlet's package. Do not include
a filename extension to the class name as this is added
automatically when the file is created.
- Click Next to specify the server deployment configuration for
the servlet.
This page does not enable the Finish button until you enter a
servlet name and URL mappings that are unique to the deployment descriptor. After you create
the servlet, you can edit this information in the deployment descriptor (web.xml).
- Click Finish. The IDE opens the file for editing in the Source Editor.
- See Also
- About Servlets
- Editing a Servlet
- Viewing a JSP's Servlet
- Adding Java Persistence to a Web Application
Legal Notices