动态方法调用 :Could not find action or result

本文探讨了在使用Struts框架过程中遇到的错误提示及其解决方法,特别关注了struts.enable.DynamicMethodInvocation属性的含义和如何正确配置,以避免出现There is no Action mapped...错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误提示:
Messages: There is no Action mapped for namespace [/] and action name [user!add] associated with context path [/bjsxt_struts2_011]. 

调用URL:
http://localhost:8094/bjsxt_struts2_011/user!add


原因:
由于这是一个学习用的例子。而我的struts.xml又是直接拷贝的
http://struts.apache.org/上面的例子,
不小心把这句话给拷贝上了:
<constant name="struts.enable.DynamicMethodInvocation" value="false" />


struts.enable.DynamicMethodInvocation属性的含义是:

### Set this to false if you wish to disable implicit dynamic method invocation
### via the URL request. This includes URLs like foo!bar.action, as well as params
### like method:bar (but not action:foo).
### An alternative to implicit dynamic method invocation is to use wildcard
### mappings, such as <action name="*/*" method="{2}" class="actions.{1}">
struts.enable.DynamicMethodInvocation = true



-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值