在Eclipse使用Struts2的DMI(动态调用方法)无法调用

启动异常:There is no Action mapped for namespace [/] and action name [user!add] associated with context path。

异常语句://  href="/user!add"  删除用户

解决方法:(1)DMI可能导致安全问题(2)DMI与通配符方法功能有重叠,因此该版本Struts2默认关闭DMI,需要在struts.xml中加入下面代码来打开动态方法调用。
<constant name="struts.enable.DynamicMethodInvocation" value="true" />

动态方法调用官方推荐的做法是,使用通配符的形式。不要使用actionName!methodName的方式。

 
调试结果:异常解决,可正常运行 
点点滴滴,终汇一海
原文地址:https://www.cnblogs.com/forever-cjs/p/4975855.html