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="轉發的action的成員名">${被轉發的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

          導航

          統計

          公告

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

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          相冊

          收藏夾

          Java Website

          java技術博客

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 民乐县| 雅安市| 城固县| 扎赉特旗| 渭源县| 双江| 当涂县| 高密市| 信宜市| 修水县| 闵行区| 兰坪| 凭祥市| 德惠市| 平利县| 青州市| 马边| 怀化市| 婺源县| 中卫市| 漯河市| 旬阳县| 汪清县| 金沙县| 汉阴县| 社会| 威海市| 大英县| 姚安县| 若羌县| 扎囊县| 宁陕县| 小金县| 旬阳县| 乐至县| 泰安市| 外汇| 昭觉县| 太仓市| 尖扎县| 屯昌县|