如果将Struts2的filter-mapping配置成

<filter-mapping>  
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

的话,struts2将可以处理无后缀的action请求,如

/demo/hello.action 和/demo/hello 是同样的效果。

这样有时会出现一些问题,将有一些组件映射为无后缀的请求拦截了,如/demo/dwr 请显示对外公布的js方法列表,在struts2拦截后确显示

There is no Action mapped for namespace / and action name dwr

这种情况下可以在struts.properties中配置

struts.action.excludePattern = /dwr.*,/xxx.*

属性值是以逗号分隔的正则表达式。

相关文章:

  • 2021-10-15
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2021-05-17
  • 2021-08-05
  • 2022-12-23
  • 2021-10-25
猜你喜欢
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-12-06
  • 2021-08-05
相关资源
相似解决方案