2010-10-29 68 views
0

自從很久以來,我們一直在使用struts 1。我不太瞭解struts 2.我們公司正在使用基於組件的arch。核心UI組件正在使用struts 1.舊的struts 1組件以及新的struts 2組件將使用核心組件。我不確定是否struts 1動作請求可以重定向到struts 2動作,反之亦然。例如我們有一個在struts中創建的列表框架。使用這個框架將會發佈列表頁面。現在,如果用戶通過在列表屏幕上選擇記錄來執行任何操作,則struts 2動作將被調用,完成請求後,它將被重定向回到列表頁面(這是struts 1操作)。將struts 2動作重定向到struts 1動作

回答

3

要重定向Struts2的行動,一個struts1的行動,把你的支柱下面的struts.xml 2文件:

<action name="myAction" class="myClass" method="execute"> 
    <result name="success">/mystruts2page.jsp</result> 
    <result name="mystruts1redirect" type="redirect"> 
    <param name="location">/MyStruts1Action.do?submit=View&amp;noticeId= ${nextNoticeId </param> 
    </result> 
    <interceptor-ref name="myInterceptorStack"/> 
</action> 

請注意,您必須使用「&放大器;」 (沒有空格)和「$ {field}」來正確解析/傳遞OGNL參數。