Struts 2.5 Action动态调用 SMI 配置

xiaoxiao2021-02-28  136

Struts 2.5 Action动态调用 SMI 配置

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.i18n.encoding" value="UTF-8"/> <constant name="struts.enable.DynamicMethodInvocation" value="true"/> <package strict-method-invocation="false" name="default" namespace="/" extends="struts-default"> <action name="user" class="com.action.UserAction"> <result name="hello">/hello.jsp</result> <result name="update">/update.jsp</result> </action> </package> </struts>

其中,需要使用的坂本为Struts 2.5 DTD, struts.enable.DynamicMethodInvocation需要设置为true打开DMI功能, package 的strict-method-invocation属性值默认为true,需要关闭改为false,否则报错提示:

HTTP Status 404 - Method update for action user is not allowed!


type Status report

message Method update for action user is not allowed!

description The requested resource is not available.


Apache Tomcat/7.0.78

参考文档:http://struts.apache.org/docs/action-configuration.html

转载请注明原文地址: https://www.6miu.com/read-18921.html

最新回复(0)