分类分类
2015-09-23 16:31作者:yezheng
本文小编将为大家介绍一个简单的web.xml配置(ssh项目),有需要的朋友来看看这篇教程吧
代码如下:
web.xml配置
<!-- 配置不同目录的首页集:welcome-file-list -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
配置监听器和上下文参数和struts2过滤器
<!-- 配置上下文参数:contextConfigLocation -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/applicationContext-*.xml</param-value>
</context-param>
<!-- 配置监听器:在web项目启动时初始化IoC容器(装配 contextConfigLocation参数所指定的文件的配置信息)-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置Struts2总控制器,必须是最后一个filtermapping -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,/config/struts.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
配置过滤器,解决乱码、懒加载等问题
相关