2012-03-08 151 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" />