<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="struts_1" namespace="/" extends="struts-default"> <action name="hello" class="com.myweb.web.action.OtherAction" method="hello"> <!-- 这里是action互相转发效果,注意类属性在转发后可以继承,也就是转发后OtherAction中属性a在UserAction属性a的值是一样的 --> <result name="success" type="chain"> <param name="actionName">hello2</param> <param name="namespace">/s</param> </result> </action> <action name="hello1" class="com.myweb.web.action.OtherAction" method="hello"> <!-- 这里是action互相重定向效果,注意param的name可以用来自定义get传递参数并使用${属性名}可以来赋值给传递参数,本例效果如:actionurl.action?aaa=1--> <result name="success" type="redirectAction"> <param name="actionName">hello2</param> <param name="namespace">/s</param> <param name="aaa">${aaa}</param> </result> </action> </package> <package name="struts_2" namespace="/s" extends="struts-default"> <action name="hello2" class="com.myweb.web.action.UserAction" method="hello1"> <result name="success">/pages/hello.jsp</result> </action> </package> </struts>