2012-03-08 77 views
2

我正在開發一個項目,讓我們用新的struts 2應用程序替換舊的struts 1應用程序。然而,我們新的Struts 2應用程序需要與許多其他商業應用程序一起工作,這些應用程序希望用相同的URL調用應用程序。所以,會出現鏈接,如Struts 2多個URL擴展

businessApplication /視圖/ getById.do?ID = XXXXXXXXXX

我們的新的應用程序不使用後綴(不過,你可以選擇指定.action後綴),而不是到。做後綴。我想要做的是捕捉那些舊網址(用。做後綴),並轉發到相應的操作,如:?

businessApplication /視圖/ findById編號= XXXXXXXX

但是,我無法找到用.do後綴捕獲任何東西的方法。我嘗試設置動作名稱getById.do和getById *無濟於事。

任何想法?

謝謝!

回答

5

,我發現我的答案在此之上答案:web.xml filter-mapping not forwarding to struts

這是我加入到我的struts.xml

<!-- FOR COMPATIBILITY WITH EXTERNAL APPLICATIONS 
This constant allows actions with the suffixes of "", ".action", or ".do". This allows the creation of actions ending in .do, to allow external applications 
that may be looking for .do actions to still use this app without any changes. --> 
<constant name="struts.action.extension" value=",action,do" />