Action中的默认值
如果没有指定Action.默认是ActionSupport
如果没有指定的method。默认的是action中的execute()方法。
如果没有指定的result 的name属性。默认的是success.
<action name="test">
<result>/page/hello.jsp</result>
</action>
<result>/page/hello.jsp</result>
</action>
Action视图转发方式
1、从定向到特定的视图---redirect
通过result的type属性设置:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="papaya" namespace="/test" extends="struts-default">
<action name="hello" class="com.papaya.action.HelloAction" method="execute">
<result name="success" type="redirect">/page/hello.jsp?userName=${userName}</result>
</action>
</package>
</struts>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="papaya" namespace="/test" extends="struts-default">
<action name="hello" class="com.papaya.action.HelloAction" method="execute">
<result name="success" type="redirect">/page/hello.jsp?userName=${userName}</result>
</action>
</package>
</struts>