【问题标题】:Struts 2 Multiple URL ExtensionsStruts 2 多个 URL 扩展
【发布时间】:2012-03-08 19:34:06
【问题描述】:

我正在做一个项目,让我们用新的 struts 2 应用程序替换旧的 struts 1 应用程序。但是,我们的新 Struts 2 应用程序需要与许多其他期望使用相同 URL 调用应用程序的业务应用程序一起工作。所以,会有诸如

之类的链接

businessApplication/view/getById.do?id=XXXXXXXXXX

我们的新应用程序不使用后缀(不过,您可以选择指定 .action 后缀)而不是 .do 后缀。我想要做的是捕获那些旧 URL(带有 .do 后缀)并转发到适当的操作,例如:

businessApplication/view/findById?Id=XXXXXXXX

但是,我找不到使用 .do 后缀捕获任何内容的方法。我尝试将操作名称设置为 getById.do 和 getById* 无济于事。

有什么想法吗?

谢谢!

【问题讨论】:

    标签: java struts2


    【解决方案1】:

    我在最佳答案中找到了我的答案: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" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-03
      • 1970-01-01
      • 2013-03-31
      • 1970-01-01
      • 2014-01-15
      • 2012-05-09
      • 1970-01-01
      • 2015-12-28
      相关资源
      最近更新 更多