zoukankan      html  css  js  c++  java
  • 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

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

  • 相关阅读:
    linux下golang的配置
    为什么有闭包?
    分布式之高性能IO组件
    ECMAScript 5.1 Edition DOC 学习笔记
    直线光栅画法
    【计算机基础】三、指令与指令执行过程
    ThreadLocal的使用
    【设计模式】单例模式
    问题记录
    【Java基础】- 泛型
  • 原文地址:https://www.cnblogs.com/howlaa/p/2623476.html
Copyright © 2011-2022 走看看