HuyPV
Thursday, September 9, 2010
<?xml version="1.0" encoding="ISO-8859-1"?>
The web.xml file defines each servlet and JSP page within a Web Application. It also enumerates enterprise beans referenced in the Web application.
The file goes into the WEB-INF directory under the document root of a web application.
A sample web.xml
This xml file is alls called deployment descriptor.
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>
The name of the application
</display-name>
<description>
C'mon, you know what goes into a description, don't you?
</description>
<context-param>
<param-name>name_of_context_initialization_parameter</param-name>
<param-value>value_of_context_initializtion_parameter</param-value>
<description> Again, some description </description>
</context-param>
<servlet>
<servlet-name>guess_what_name_of_servlet</servlet-name>
<description>Again, some description</description>
<servlet-class>com.foo-bar.somepackage.TheServlet</servlet-class>
<init-param>
<param-name>foo</param-name>
<param-value>bar</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>name_of_a_servlet</servlet-name>
<url-pattern>*.some_pattern</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>image</servlet-name>
<url-pattern>/image</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
Title:
Java Web Application File web.xml
Description:
<?xml version="1.0" encoding="ISO-8859-1"?> The web.xml file defines each servlet and JSP page within a Web Appli...
...
Rating:
4