2018.12.16 struts.xml 结果集方式分析 && 源码查看

1.结果集

转发
重定向
转发Action
重定向Action
<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
<!-- 是否开启开发模式
	struts.enable.DynamicMethodInvocation = false
 -->
	<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>
	
	<package name="result" namespace="/" extends="struts-default">
		<!-- 转发 -->
		<action name="Demo1Action" class="com.legend.action.Demo1Action" method="execute">
			<result name="success" type="dispatcher">/hello.jsp</result>
		</action>
		
		<!-- 重定向 -->
		<action name="Demo2Action" class="com.legend.action.Demo2Action" method="execute">
			<result name="success" type="redirect">/hello.jsp</result>
		</action>
		
		<!-- 转发到action -->
		<action name="Demo3Action" class="com.legend.action.Demo3Action" method="execute">
			<result type="chain">
            	 <!-- action的名字 -->
            	 <param name="actionName">Demo1Action</param>
            	 <!-- action所在的命名空间 -->
            	 <param name="namespace">/</param>
         	</result>
		</action>
		
		<!-- 转发到action -->
		<action name="Demo4Action" class="com.legend.action.Demo4Action" method="execute">
			<result type="redirectAction">
				<!-- action的名字 -->
             	<param name="actionName">Demo1Action</param>
             	<!-- action所在的命名空间 -->
             	<param name="namespace">/</param>
         	</result>
		</action>
	</package>
	
	<!-- 引入xml文件 -->
	<include file="com/legend/b_api/struts.xml"></include>
	<include file="com/legend/c_param/struts.xml"></include>
</struts>	
posted @ 2018-12-16 19:14  LegendQi  阅读(94)  评论(0编辑  收藏  举报