struts2 dwr There is no Action mapped for action ... 原因及解决方案
2017-07-27 22:47
405 查看
<!--struts2配置时,在web.xml中的配置如下:--> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
dwr 在 web.xml 中的配置如下:
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
struts2 使用 /* 作为 url-pattern,而且在struts机制中,只要请求路径中无后缀名或者后缀名为 .action ,它就当 action 来处理。所以当配置了dwr之后,在测试页中,本来点击类之后应该显示当前系统中对外暴露的JS方法的列表,却显示了There is no Action mapped for action... 类似的信息,就是因为点击了类名链接后,路径中没有了后缀名。解决方法有两个:
(1)在Struts.properties中定义:
struts.action.extension = action
因为Struts2缺省配置是:
struts.action.extension = action,(注意后面有个逗号)
(2)在Struts.properties中设置:
struts.action.excludePattern = /dwr.*,/webEditor.*(注意,这儿是正则表达式,不是URL匹配模式,所以要写/dwr.*而不是/dwr/*)
这种写法应配置StrutsPrepareAndExecuteFilter,配置FilterDispatcher是无效的。
(3)直接在Struts.xml中加入
<!--该属性指定需要Struts 2处理的请求后缀,该属性的默认值是action,即所有匹配*.action的请求都由Struts 2处理.如果用户需要指定多个请求后缀,则多个后缀之间以英文逗号(,)隔开. -->
<constant name="struts.action.extension" value="action" />
相关文章推荐
- struts2 dwr There is no Action mapped for action ... 原因及解决方案
- 发布Struts2工程打开action链接提示There is no Action mapped for namespace / and action name **解决方案
- struts2用注解开发出错二 There is no Action mapped for namespace [/] and action name [zhujie] associated with
- struts2 第一个程序 以及错误There is no Action mapped for action name hello 解决
- ssh整合DWR的时候报 HTTP Status 404 - There is no Action mapped for namespace / and action name bookInfo.
- There is no Action mapped for namespace [/] and action name 原因分析
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
- struts2用注解开发出错一 There is no Action mapped for namespace [/] and action name [zhujie] associated with
- MyEclispe配置struts2出现There is no Action mapped for namespace [/] and action name [user_all]...问题处理
- struts2 - There is no Action mapped for namespace [/login] and action name [login!loginInput] ...
- eclipse 部署struts2 There is no Action mapped for namespace / and action name
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
- 使用SSH时there is no action mapped for namespace[/]错误的解决方案
- Struts2中DMI(动态方法调用)的错误问题(There is no Action mapped for namespace [/xxx] and action name [xxx!yyy] a)
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结 今天在调试一个基础的Struts2框架小程
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
- [转]struts2的异常There is no Action mapped for namespace / and action name
- 关于struts2中的There is no Action mapped for namespace / and action name .