<!-- web监听 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置struts过滤器,接管所有的请求 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 常量配置 -->
<!-- 开发模式打开 -->
<constant name="struts.devMode" value="true" />
<!-- 声明action对象的管理交给spring容器 -->
<constant name="struts.objectFactory" value="spring" />
<!-- action配置:包,命名空间,action,result等等 -->
<package name="zidingyide" extends="struts-default" namespace="/">
<!-- name表示请求的url:/rams/user_* -->
<!-- class表示请求的处理action对象 -->
<!-- method表示处理请求的方法名,{1}与name中第一次出现的通配符关联 -->
<action name="user_*" class="userAction" method="{1}">
<!-- result表示响应的结果,此处响应webapp根目录下面的index.jsp页面 -->
<result name="success">/index.jsp</result>
</action>
</package>
原文:http://www.cnblogs.com/xiaoniaofei666/p/7846402.html