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 閱讀(455) 評論(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ù)博客

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 吉木萨尔县| 丰城市| 安化县| 垦利县| 集安市| 白水县| 绥棱县| 华阴市| 康平县| 红安县| 吉木乃县| 泗水县| 曲松县| 正定县| 阳城县| 阜平县| 无极县| 荃湾区| 托里县| 新和县| 楚雄市| 波密县| 洪江市| 芷江| 金川县| 上栗县| 南投县| 尉氏县| 文化| 荥阳市| 汝阳县| 和硕县| 万安县| 格尔木市| 政和县| 长寿区| 策勒县| 阿瓦提县| 莒南县| 太谷县| 突泉县|