struts2结果类型
生活随笔
收集整理的這篇文章主要介紹了
struts2结果类型
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
<?xml?version="1.0"?encoding="UTF-8"?> <!DOCTYPE?struts?PUBLIC "-//Apache?Software?Foundation//DTD?Struts?Configuration?2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package?name="resulttype"?namespace="/resulttype"?extends="struts-default"> <default-action-ref?name="helloWorldAction"></default-action-ref> <action?name="resulttypeAction"?class="cn.itcast.resulttype.ResulttypeAction"> <!--?方法一?默認為轉發, *type:指定結果類型,默認為轉發"dispatcher"? --> <!--?<result?name="success"?type="dispatcher">/resulttype/success.jsp</result>--> <!--?方法二?--> <!--?<result?name="success"?type="dispatcher"> param:參數 *name:參數的名稱為"location" 實際上,是struts2框架底層的StrutsResultSupport類的setLocation()提供的 *?所謂的參數,應該是set方法或者get方法后面跟的名稱才是參數名 <param?name="location">/resulttype/success.jsp</param> </result>?--> <!--?重定向到jsp:org.apache.struts2.dispatcher.ServletRedirectResult?--> <!--?<result?name="success"?type="redirect"> <param?name="location">/resulttype/success.jsp</param> </result>?--> <!--?重定向到action?--> <result?name="success"?type="redirectAction"> <!--? param: *actionName:指定"目的地"動作的名字。指定的是Struts.xml文件action標簽的name屬性的值 *namespace:指定的是struts.xml文件,action對應的package下的namespace屬性的值 --> <param?name="actionName">helloWorldAction</param> <param?name="namespace">/primer</param> </result> </action> </package> </struts>?
總結
以上是生活随笔為你收集整理的struts2结果类型的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: javax.el.ELException
- 下一篇: Struts2中jsp page=xxx