struts框架使用的通配符调用方法配置:

<package name="hew" extends="struts-default">
    <!-- 配置Action -->
    <action name="action_*" class="action" method="{1}">
        <result name="SUCCESS">index.jsp</result>
    </action>
</package>

其中<action name="action_*" class="action">中的name="action_*"中的*代表的是method="{1}"中的{1}的值,并对应Action类中的一个方法名。

注:struts2.3之前使用以上配置正常,struts2.3之后,使用通配符调用方法要加上<allowed-mthods>方法名1,方法名2..</allowed-mthods>

<package name="hew" extends="struts-default">
    <!-- 配置Action -->
    <action name="action_*" class="action" method="{1}">
        <result name="SUCCESS">index.jsp</result>
        <allowed-mthods>方法名1,方法名2..</allowed-mthods>
    </action>
</package>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2021-04-08
  • 2023-03-28
  • 2021-05-30
猜你喜欢
  • 2021-10-29
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-10-31
  • 2022-01-07
  • 2021-12-13
相关资源
相似解决方案