December 2003
Intermediate to advanced
764 pages
24h 58m
English
Example F-2 shows an example of a deployment descriptor (web.xml) file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4>
<servlet>
<servlet-name>
purchase
</servlet-name>
<servlet-class>
com.mycomp.servlets.PurchaseServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
purchase
</servlet-name>
<url-pattern>
/po/*
</url-pattern>
</servlet-mapping>
</web-app>At the top of the file, you find a standard XML declaration and the
<web-app> element, with the reference to the
deployment descriptor schema. Then follows a
<servlet> element that defines a servlet
named purchase, and a
<servlet-mapping> element that maps the
servlet to the /po/* path prefix pattern.
Read now
Unlock full access