Struts 中There is no Action mapped for namespace / and action name...问题的解决

   在学习struts时遇到There is no Action mapped for namespace / and action name...的错误提示,网上有很多总结,这里有一篇文章总结得很好:http://www.cnblogs.com/gulvzhe/archive/2011/11/21/2256632.html

但还有一种情况可能导致这个问题,这里没有给出。我遇到的就是这种情况。

Struts2.3.x或更高的某些版本时出现There is no Action mapped for namespace [/user] and action name [user!add] associated with context path错误,原因是(1)DMI可能导致安全问题(2)DMI与通配符方法功能有重叠,因此该版本Struts2默认关闭DMI,需要在struts.xml中加一句<constant name="struts.enable.DynamicMethodInvocation" value="true" /> 来打开动态方法调用。动态方法调用官方推荐的做法是,使用通配符的形式。不要使用actionName!methodName的方式[注]。

猜你喜欢

转载自blog.csdn.net/qq_36935391/article/details/80542248
今日推荐