2015-08-13 49 views
1

我們正在慢慢地將我們的應用程序從Struts1遷移到Struts 2,但是對於第一次迭代,我們只需讓它們一起運行,並且所有新頁面都將在Struts2中運行。我的問題是:如何從strut1頁面導航到struts2頁面?從Struts1頁面導航到Struts 2頁面

我有一個struts1頁面,允許用戶選擇報告類型。除了一個選擇外,其餘的都是struts1。最後一個選擇是一個struts2頁面。我需要從選擇屏幕(struts1)到新的struts2頁面。

下面是一些代碼: struts-config.xml

<action path="/reporting" type="........ReportingAction" name="reportForm" input="/WEB-INF/jsps/reporting.jsp" scope="session"> 
    <forward name="outbound" path="/WEB-INF/jsps/reportingSelectDate.jsp"> 
    </forward> 
    <forward name="inbound" path="/WEB-INF/jsps/reportingInboundSelectDate.jsp"> 
    </forward> 
    <forward name="usage" path="/WEB-INF/jsps/reportingUsageSelectDate.jsp"> 
    </forward> 
    <forward name="expansion" path="/s2/expansionReportEntry.jsp"> 
    </forward> 
    <forward name="failure" path="/WEB-INF/jsps/reporting.jsp"> 
    </forward> 
    <forward name="login" path="/login.do"> 
    </forward> 
</action> 

我要轉發"expansion"到新的Struts 2頁。這是正確的方式去解決它嗎?假設我已經正確設置了struts.xmlweb.xml。我有struts2過濾器處理.action和struts1做.do

+0

我建議遷移上的行動對行動的基礎,而在視圖/頁的基礎。在遷移操作時,遷移所有受影響的頁面。 –

+0

從你的建議 - 你是說我應該將所有報告功能遷移到Struts2,而不是同時維護struts1報告和struts2報告? – mhugh220

+0

是的,一次一個動作。在問題的背景下,完整的報告行動。 –

回答

1

正確的方法是重定向到新的框架,即使保持兩個框架,不建議

<forward name="expansion" path="/s2/expansionReportEntry.action" redirect="true">