默認Action設置
在Structs2.xml裏面寫
<package name="test" namespace="/" extends="struts-default">
<default-action-ref name="hello"></default-action-ref>
<!-- 定義默認的Action -->
<action name="hello">
<result>
/Hello.jsp
</result>
</action>
裏面的<default-action-ref name="hello"></default-action-ref> 默認action就是hello
result設置
result 的類型有
1.dispatcher(不設置則大多數爲這種類型) 服務器可跳轉到JSP,html
2.redirect 服務器可跳轉到JSP,html
3.chain 服務器可跳轉到別的Action裏面
我們以例子chain爲例子
<action name="hello">
<result>
/Hello.jsp
</result>
</action>
<action name="go_hello">
<result type="chain">
<param name="actionName">hello</param>
<param name="namespace">/</param>
</result>
</action>
在瀏覽器打go_hello即可