• 2012/8/4 指定需要struts2处理的请求后缀


    默认后缀是可以通过常量“struts.action.extension”进行修改的,例如:我们可以配置struts2只处理以.do为后缀的请求路径:

    <struts>

    <constant name="struts.action.extension" value="do"></constant> 

    </struts>

    如果用户需要指定多个请求后缀,则多个后缀之间以英文逗号隔开。如

    <struts>

    <constant name="struts.action.extension" value="do,action"></constant> 

    </struts>

    常量可以在struts.xml或struts.properties中配置,建议在struts.xml中配置,两种配置方式如下:

    在struts.xml文件中配置常量

    <struts>

      <constant name="struts.action.extension" value="do/">

    </struts>

    在struts.properties中配置常量

    struts.action.extension=do

    常量可以在多个配置文件中进行定义,struts2加载常量的搜索顺序如下:

    ①struts-default.xml

    ②struts-plugin.xml

    ③struts.xml

    ④struts.properties

    ⑤web.xml

    如果在多个文件中配置了同一个常量,则后一个文件中配置的常量值会覆盖前面文件中配置的常量值。

  • 相关阅读:
    毕业设计:参考文献(3)
    毕业设计:参考文献(5)
    毕业设计:参考文献(1)
    毕业设计:参考文献(7)
    毕业设计:参考文献(2)
    2021ICPC沈阳站游记
    2021CCPC广州站游记
    常用linux 脚本
    Jenkins调优实践
    linux工具安装
  • 原文地址:https://www.cnblogs.com/howlaa/p/2623476.html
Copyright © 2020-2023  润新知