在使用了Maven后出现了There is no Action mapped for namespace [/] and action name [*] associated with context
来源:互联网 发布:一维数组排序算法 php 编辑:程序博客网 时间:2024/05/29 07:20
本来没打算使用maven的,但是后来管那些包冲突实在没法了,只能又添上了maven管理。然而却发现,在使用了maven后,动态调用action里面的方法的时候报异常,出现了There is no Action mapped for namespace [/] and action name [*] associated with context path [*]. - [unknown location]异常。很奇怪,因为我没使用maven之前多次试验时可以运行的,但是使用之后却无法运行。
只能检查代码,我本来写的动态调用action里面的方法的代码是:
<s:form action="student!add">
然后修改成通配符调用却可以,再然后尝试使用不调用action动态方法也可以,没有发现异常。这证明了我的struts的配置没有问题。
几番思考后找不到答案,谷歌百度之,然而却发现都是说这个是struts的package配置出错,和我实际不符。
后来请教同学,几番讨论寻找答案后终于找到了答案。
在李刚老师写的《轻量级Java EE企业应用实战(第三版)》第188页中有一段话:使用动态方法调用前必须配置Struts2运行方法调用。开启系统的动态方法调用时设置struts.enable.DynamicMethodInvocation常量完成的,设置改常量的值为true,将开启动态方法调用,否则将关闭动态方法调用。
在struts.xml中配置<constant name="struts.enable.DynamicMethodInvocation" value="true"/> 后,运行果然成功。觉得同学说的那句话很对,”看书不看仔细就是容易bug“啊。
Ps:至今仍无法明白为什么没配maven前,使用却没有问题。如果哪位前辈知道,请不吝赐教,万分感谢。
- 在使用了Maven后出现了There is no Action mapped for namespace [/] and action name [*] associated with context
- There is no Action mapped for namespace [/] and action name [hello] associated with context path [/
- There is no Action mapped for namespace [] and action name [] associated with context path []
- There is no Action mapped for namespace [/] and action name [upload/] associated with context path
- There is no Action mapped for namespace [/] and action name [Login] associated with context path [/e
- There is no Action mapped for namespace [/] and action name [] associated with context path [/struts
- There is no Action mapped for namespace [/] and action name [viewLogAction] associated with context
- There is no Action mapped for namespace [/] and action name [login] associated with context path [/M
- There is no Action mapped for namespace [/] and action name [] associated with context path [/dxm__s
- There is no Action mapped for namespace [/] and action name [hello2] associated with context path [/
- struts2配置错误 There is no Action mapped for namespace [/] and action name [] associated with context
- Messages: There is no Action mapped for namespace [/] and action name [] associated with context pat
- There is no Action mapped for namespace [/] and action name [spropertyvalue] associated with context
- There is no Action mapped for namespace [/] and action name [user!add] associated with context path
- There is no Action mapped for namespace [/] and action name [spropertyvalue] associated with context
- There is no Action mapped for namespace [/] and action name [Person] associated with context path
- There is no Action mapped for namespace[/] and action name [] associated with context path.
- There is no Action mapped for namespace [/] and action name [login] associated with context path [/p
- JS获取单元格所在行
- Python __call__
- HTML Forms & Form element
- 同源策略以及cookie安全策略
- HTML笔记——背景&颜色
- 在使用了Maven后出现了There is no Action mapped for namespace [/] and action name [*] associated with context
- 简单opencv人脸检测代码:LBP/Haar特征
- 仿SlidingMenu
- [PB]-大文本(Blob)对象处理
- VB6.0工具的使用
- cin用法介绍
- php解析网页并将数据添加到数据库
- Django 学习笔记2 模板
- Dll高级功能