What are the basic steps to run a servlet?
The key steps in creating and running a servlet are outlined below in the simplest form. There are different techniques that can be used to complete these stages, described in other FAQ answers. • Write and compile your servlet, e.g. ExampleServlet.class • Create a Web application directory structure under the webapp directory of your servlet container (or use an existing one), e.g. {webapps-dir}/example {webapps-dir}/example/WEB-INF {webapps-dir}/example/WEB-INF/classes • Place your servlet class file in the WEB-INF/classes directory for your application, e.g. {webapps-dir}/example/WEB-INF/classes/ExampleServlet.class • Create a WEB-INF/web.xml file for your application (or edit an existing one) and add servlet and servlet-mapping elements for your servlet, e.g. {webapps-dir}/example/WEB-INF/web.xml • Start the servlet container. Actions: Follow-up, clarify or correct this answer. Submit a new question.