yxhxj2006

常用链接

统计

最新评论

ssh框架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">
   
    <!-- 配置spring的监听器 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext*.xml</param-value>
    </context-param>
   
    <!-- 开启监听 -->
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
   
    <!-- 配置OpenSessionInViewFilter,必须在struts2监听之前 -->
    <!--
    <filter>
        <filter-name>lazyLoadingFilter</filter-name>
        <filter-class>
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        </filter-class>
    </filter>
    <filter-mapping>
     <filter-name>lazyLoadingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
     -->
    <!-- 设置监听加载上下文 -->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
           org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        </filter-class>
    </filter>
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>                         <!--注意:千万不能写成:*.action ,如果需要:*.action应该配置在struts.xml中-->
 </filter-mapping>
 
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

posted on 2012-07-09 17:28 奋斗成就男人 阅读(10967) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: