一个web.xml模板

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.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">

<display-name>netctoss_web</display-name>

<!-- 调用log4j.property需要配置此处-->

<context-param>

<param-name>log4jConfigLocation</param-name>

<param-value>/WEB-INF/log4j.properties</param-value>

</context-param>

<filter>

<filter-name>EncodingFilter</filter-name>

<filter-class>tarena.netctoss.util.EncodingUtil</filter-class> </filter>

<filter-mapping>

<filter-name>EncodingFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

<filter>

<filter-name>hibernateFilter</filter-name>

<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>hibernateFilter</filter-name>

<url-pattern>*.do</url-pattern> </filter-mapping>

<!--调用起始页的设置-->

<welcome-file-list>

<welcome-file>/index.jsp</welcome-file>

</welcome-file-list>

<listener>

<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>

</listener>

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<!--对于多个模块时,文件配置可以分开写,互不干扰-->

<init-param>

<param-name>config</param-name>

<param-value> /WEB-INF/struts-config.xml,/WEB-INF/struts-config-pricing.xml, /WEB-INF/struts-config-user.xml,/WEB-INF/struts-config-userService.xml, /WEB-INF/struts-config-admin.xml,/WEB-INF/struts-config-login.xml, /WEB-INF/struts-config-page.xml,/WEB-INF/struts-config-page.xml

</param-value>

</init-param>

<init-param>

<param-name>config/pricing</param-name>

<param-value>/WEB-INF/struts-config-pricing.xml</param-value>

</init-param>

<init-param>

<param-name>config/user</param-name>

<param-value>/WEB-INF/struts-config-user.xml</param-value>

</init-param>

<init-param>

<param-name>config/userService</param-name>

<param-value> /WEB-INF/struts-config-userService.xml </param-value>

</init-param> <init-param>

<param-name>config/admin</param-name>

<param-value>/WEB-INF/struts-config-admin.xml</param-value>

</init-param>

<init-param>

<param-name>config/login</param-name>

<param-value>/WEB-INF/struts-config-login.xml</param-value>

</init-param>

<init-param>

<param-name>config/page</param-name>

<param-value>/WEB-INF/struts-config-page.xml</param-value>

</init-param>

<init-param>

<param-name>debug</param-name>

<param-value>2</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

</servlet>

<!--struts一般访问时以*.do的形式-->

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern> </servlet-mapping>

</web-app>

你可能感兴趣的:(Web,xml,log4j,struts,servlet)