问答详情
源自:4-4 动态方法调用-深入Struts2

通配符直接访问“HelloWorld_.action”为什么404?

<?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>

<package name="default" namespace="/" extends="struts-default">

<action name="*_*" method="{2}" class="imis.black.action.{1}Action">

<result>/result.jsp</result>

<result name="add">/{2}.jsp</result>

<result name="update">/{2}.jsp</result>

<!-- 允许使用通配符的指令,中间是方法名,多个方法名之间用逗号隔开 -->

<allowed-methods>add,update</allowed-methods>   

</action>

</package>

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

</struts>


提问者:慕粉3971981 2018-04-08 20:05

个回答

  • 仇广义
    2018-04-10 22:30:47
    已采纳

    <package name="default" namespace="/" extends="struts-default"
      strict-method-invocation="false">改下这个试试