<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>struts2_bar</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <!-- 设置session 有效时间 --> <session-config> <session-timeout>30</session-timeout> </session-config> <servlet> <servlet-name>authImg</servlet-name> <servlet-class>org.cric.util.AuthImg</servlet-class> </servlet> <servlet-mapping> <servlet-name>authImg</servlet-name> <url-pattern>/authImg</url-pattern> </servlet-mapping> <!--过滤器解析 *.jsp 因为要解析sturts标签--> <filter> <filter-name>struts</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> </web-app>