Redirect Action Result

          Redirect Action Result : This redirect pattern is supported by Struts 2. The ActionMapper provided by the ActionMapperFactory is used to redirect the browser to a URL that invokes the specified action. You can see a simple implementation of this in the following struts 2 application.?

          Redirects Dynamic Parameters: The action-redirect result takes following parameters:

          • actionName
          • namespace
          • method
          • encode
          • parse
          • location
          • prependServletContext


          parameters ------------

        1. actionName (default) - the name of the action that will be redirect to

        2. namespace - used to determine which namespace the action is in that we're redirecting to . If namespace is null, this defaults to the current namespace

          ?

          <package?name="public"?extends="struts-default">
          ????
          <action?name="login"?class="">
          ????????
          <!--?Redirect?to?another?namespace?-->
          ????????
          <result?type="redirect-action">
          ????????????
          <param?name="actionName">dashboard</param>
          ????????????
          <param?name="namespace">/secure</param>
          ????????
          </result>
          ????
          </action>
          </package>

          <package?name="secure"?extends="struts-default"?namespace="/secure">
          ????
          <--?Redirect?to?an?action?in?the?same?namespace?-->
          ????
          <action?name="dashboard"?class="">
          ????????
          <result>dashboard.jsp</result>
          ????????
          <result?name="error"?type="redirect-action>error</result>
          ????</action>

          ????<action?name="
          error"?class="">
          ????????
          <result>error.jsp</result>
          ????
          </action>
          </package>

          <package?name="passingRequestParameters"?extends="struts-default"?namespace="/passingRequestParameters">
          ???
          <--?Pass?parameters?(reportType,?width?and?height)?-->
          ???
          <!--
          ???The?redirect-action?url?generated?will?be?:
          ???/genReport/generateReport.action?reportType=pie&width=100&height=100
          ???
          -->
          ???
          <action?name="gatherReportInfo"?class="">
          ??????
          <result?name="showReportResult"?type="redirect-action">
          ?????????
          <param?name="actionName">generateReport</param>
          ?????????
          <param?name="namespace">/genReport</param>
          ?????????
          <param?name="reportType">pie</param>
          ?????????
          <param?name="width">100</param>
          ?????????
          <param?name="height">100</param>
          ??????
          </result>
          ???
          </action>
          </package>
        3. 例如
        4. <param name="轉(zhuǎn)發(fā)的action的成員名">${被轉(zhuǎn)發(fā)的action中變量}</param>
          ???<param name="fileName">${fileName}</param>

          posted on 2009-04-26 22:59 luofeng225 閱讀(450) 評論(0)  編輯  收藏 所屬分類: Struts2

          <2009年4月>
          2930311234
          567891011
          12131415161718
          19202122232425
          262728293012
          3456789

          導(dǎo)航

          統(tǒng)計

          公告

          我曾經(jīng)聽到這么一個故事: 一個年輕的程序員問一個老程序員(一個比較牛逼的公司的CTO) 年輕程序員: 你為什么這么牛X., 就好像沒有你不會的。老程序員: 積累的。年輕程序員: 怎么才能積累到您的程度呢。我每天都在積累。但是似乎都沒有感覺到進(jìn)步。老程序員: 我從20歲開始做到了一件事情,直到今天,而且盡可能地保證不間斷。年輕程序員: 到底是什么? 老程序員: 我每天保證自己有2個小時在學(xué)習(xí)新的東西。

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          相冊

          收藏夾

          Java Website

          java技術(shù)博客

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 宁津县| 罗甸县| 保德县| 武清区| 峨眉山市| 青铜峡市| 新密市| 海伦市| 敖汉旗| 板桥市| 土默特右旗| 阳谷县| 运城市| 怀柔区| 垫江县| 大庆市| 墨竹工卡县| 通化市| 什邡市| 沽源县| 天镇县| 南陵县| 黎平县| 城市| 儋州市| 察哈| 常宁市| 长岛县| 怀化市| 宜君县| 札达县| 德阳市| 项城市| 永顺县| 钟祥市| 井研县| 杭州市| 喀喇沁旗| 高阳县| 军事| 米林县|