动态方法调用时,异常
2016-12-16 09:42:43,166 ERROR [http-nio-8080-exec-6] dispatcher.Dispatcher (Dispatcher.java:599) - Could not find action or result: /web/user!update.action
com.opensymphony.xwork2.config.ConfigurationException: There is no Action mapped for namespace [/] and action name [user!update] associated with context path [/web].at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:192) ~[struts2-core-2.5.5.jar:2.5.5]
at org.apache.struts2.factory.StrutsActionProxy.prepare(StrutsActionProxy.java:63) ~[struts2-core-2.5.5.jar:2.5.5]
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
Method update for action user is not allowed!
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<constant name="struts.configuration.xml.reload" value="true"></constant>
<!-- 在2.5版本,是否启用动态调用有个选项,默认值为false 想启用的话, 要改成true -->
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
<!-- strict-method-invocation在2.5版本,为了限制DMI,默认启用了严格的方法访问,不想启用要改为false -->
<package name="default" extends="struts-default" strict-method-invocation="false">
<!-- 在2.5版本,想要使用通配符,增加这个选项 -->
<global-allowed-methods>regex:.*</global-allowed-methods>
<action name="user" class="com.action.UserAction">
<result name="hello">/hello.jsp</result>
<result name="update">/update.jsp</result>
</action>
</package>
</struts>