解决Struts2版本2.5之后通配符不能使用的方法

struts2从2.5版本开始,为了提升安全性,默认开启了严格的方法调用。

如果要使用通配符*,必须在package中设置 strict-method-invocation="false",代码如下:

<package name="user" extends="struts-default" strict-method-invocation="false">

<action name="*" class="com.hanhai.web.action.UserAction" method="{1}">

<result name="success">/Login.jsp</result>

</action>

</package>

这样通配符才能正常使用。

猜你喜欢

转载自blog.csdn.net/document_hk/article/details/86758906