struts2全局视图分为两种:
1. 包全局视图
<struts>
<package name="demo" namespace="/test" extends="struts-default">
<global-results>
<result>/welcome.jsp</result>
<result name="fail">/fail.jsp</result>
</global-results>
<action name="some" class="com.codingdit.actions.LoginAction" method="doSome" />
<action name="second" class="com.codingdit.actions.LoginAction" method="doSecond">
<result name="old">/old.jsp</result>
</action>
</package>
</struts>
2.定义应用全局视图(使用包继承实现,被继承的包可以定义为抽象包):
<struts>
<package name="myBase" extends="struts-default" abstract="true">
<global-results>
<result>/welcome.jsp</result>
<result name="fail">/fail.jsp</result>
</global-results>
</package>
<package name="demo" namespace="/test" extends="myBase">
<action name="some" class="com.codingdict.actions.LoginAction" method="doSome" />
<action name="second" class="com.codingdict.actions.LoginAction" method="doSecond">
<result name="old">/old.jsp</result>
</action>
</package>
</struts>
更多struts2详细教程请访问struts2教程