Struts2.5版本的不能使用动态方法绑定 查了下说是调用实体类action时不安全,新版本中默认关闭了 ,要配置打开
<?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.enable.DynamicMethodInvocation" value="true" /> <constant name="struts.enable.DynamicMethodInvocation" value="true" /> <package name="default" extends="struts-default" namespace="/"> <!-- 关键地方 struts2.5 为了提升安全性,添加了 allomethod 这么个玩意--> <global-allowed-methods>regex:.*</global-allowed-methods> <action name="login*" class="com.maobo.action.LoginAction" method="{1}"> -------------- </action> </package> </struts>
ps:不要放额外的包,额外包需要配置