标签:
<span style="font-size:18px;"><package name="itcast" namespace="/test" extends="struts-default"> <action name="helloworld" class="cn.itcast.action.HelloWorldAction" method="execute" > <result name="success">/WEB-INF/page/hello.jsp</result> </action> </package> 1>假设没有为action指定class,默认是ActionSupport。2>假设没有为action指定method,默认运行action中的execute() 方法。 3>假设没有指定result的name属性。默认值为success。</span>
<span style="font-size:18px;"><action name="helloworld" class="cn.itcast.action.HelloWorldAction"> <result name="success">/WEB-INF/page/hello.jsp</result> </action>
<result type="redirect">/view.jsp?id=${id}</result>
<action name="redirectAction"> <result type="redirectAction">helloworld</result> </action>
<struts> <package name="itcast" namespace="/control/employee" extends="base"> <action name="list" class="cn.itcast.action.HelloWorldAction" method="execute"> <result name="success" type="redirect">/employeeAdd.jsp?username=${username}</result> </action> <action name="redirect"> <result type="redirect">/employeeAdd.jsp</result> </action> <action name="redirectAction"> <!-- 不同的命名空间下的 --> <result type="redirectAction"> <param name="actionName">xxx</param> <!-- action的名字--> <param name="namespace">/control/department</param> </result> </action> </package> <package name="other" namespace="/control/department" extends="base"> <action name="xxx"> <result>/WEB-INF/page/hello.jsp</result> </action> </package> </struts>
<result name="source" type="plainText "> <param name="location">/xxx.jsp</param> <param name="charSet">UTF-8</param><!-- 指定读取文件的编码 --> </result>
版权声明:本文博主原创文章,博客,未经同意不得转载。
【Struts2学习笔记(2)】Action默认值和配置Action于result各种转发类型
标签:
原文地址:http://www.cnblogs.com/bhlsheji/p/4842279.html