【问题标题】:Changing URL pattern to specific redirection in Struts 2 filter在 Struts 2 过滤器中将 URL 模式更改为特定重定向
【发布时间】:2016-01-31 14:44:48
【问题描述】:

目前在我们的 web.xml 中,它将使用 Struts 2 过滤所有 url,因为它是 /*,但我需要给出特定的 URL 模式(例如:/docupload/*),因为我现在正在与另一个应用程序集成。

所以另一个应用程序 URL 也通过了 Struts 过滤器并且无法正常工作。

            <filtermapping><url-pattern>/*</url-pattern><filtermapping>   

我试过这个:我在 struts.xml 中给出了“namspace”,比如“docupload”:

  <constant name="struts.devMode" value="true" />
  <package name="default" namespace="/docupload" extends="struts-default">

将命名空间添加为 /docupload,下面是我的文件夹结构

在 web.xml -

       <url-pattern>/docupload/*</url-pattern>

在创建文件夹结构并添加命名空间后 - 我改变了上面提到的 URL 模式。但它不起作用。

【问题讨论】:

标签: xml struts2 web.xml url-pattern


【解决方案1】:

如果您只是想绕过特定的 URL,您可以在 struts.xml 中使用excludePattern,如下所示

<constant name="struts.action.excludePattern" value="/docupload/*" /> 

【讨论】:

    猜你喜欢
    • 2011-12-27
    • 2016-08-14
    • 2013-09-02
    • 1970-01-01
    • 2017-08-20
    • 2014-07-16
    • 2010-09-15
    • 2013-01-16
    • 1970-01-01
    相关资源
    最近更新 更多