0
点赞
收藏
分享

微信扫一扫

Struts2动态方法调用问题


报错信息

Struts Problem Report
Struts has detected an unhandled exception:
Messages:
Method add for action user is not allowed!
Stacktraces
Method add for action user is not allowed! - [unknown location]

解决方法

在高版本的struts中
动态方法的使用配置文件中
1,开启动态方法调用

<constant name="struts.enable.DynamicMethodInvocation" value="true" />

2,规定可以被动态调用的方法

<global-allowed-methods>find,add,delete,update</global-allowed-methods>

如:

<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<package name="p3" extends="struts-default">
<global-allowed-methods>find,add,delete,update</global-allowed-methods>
<action name="user" class="org.ccit.com.web.action.UserAction">
<result name="success">/success.jsp</result>
</action>
</package>


举报

相关推荐

0 条评论