<!--web.xml 元素简介-->
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Sample Application</display-name>
<!-- 文件清单 -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<description>
This is a Page !
</description>
<!--过滤器--->
<filter>
<filter-name>SampleFilter</filter-name>
<filter-class>mypack.SampleFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SampleFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<!-- servlet 配置:<servlet-mapping> 为映射 -->
<servlet>
<servlet-name>SampleServlet</servlet-name>
<servlet-class>com.example.AddServlet.AddEmpServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SampleServlet</servlet-name>
<url-pattern>/add</url-pattern>
</servlet-mapping>
<!-- 错误页引用 -->
<error-page>
<error-code>500</error-code>
<location>/error.htm</location>
</error-page>
<!-- session 保存的秒数:300 s -->
<session-config>
<session-timeout>500</session-timeout>
</session-config>
<!-- web 中所有的标签库 -->
<taglib>
<taglib-uri>/mytaglib</taglib-uri>
<taglib-location>/WEB-INF/mytaglib.tld</taglib-location>
</taglib>
<!-- 配置资源引用:servlet 容器管理某个 JNDI Resource -->
<resource-ref>
<description>DB Connection</descrition>
<res-ref-name>jdbc/sampleDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- 配置安全登录验证页 -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Tomcat Server Configuration Form-Based Authentication Area<realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-login-config>/check.jsp</form-login-config>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
</web-app>