Deployjav
Deployjav
Servlet interface
– javax.servlet.GenericServlet
– javax.servlet.http.HttpServlet
Definitions
• A CGI program needs to be loaded and started for each CGI request.
• There is only a single instance of a servlet which answers all requests concurrently.
• The servlet container creates a ServletResponse object and passes it as an argument to the
servlet's service method.
• The deployment descriptor is a XML file called web.xml that resides in the WEB-INF directory
whitin an application.
<web-app xmlns=http://java.sun.com/xml/ns/j2ee……>
<display-name>test</display-name>
<description>test example</description>
<servlet>
<servlet-name>Testing</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Testing</servlet-name>
<url-pattern>/servlet/TestingServlet</url-pattern>
</servlet-mapping>
</web-app>
• each servlet context is identified by a unique path prefix called context path
• The remaining path is used in the selected context to find the specific Servlet to run,
following the rules specified in the deployment descriptor.
• each servlet context is identified by a unique path prefix called context path
• The remaining path is used in the selected context to find the specific Servlet to run,
following the rules specified in the deployment descriptor.