zoukankan      html  css  js  c++  java
  • struts配置访问后缀为.do,.action,.*

    Struts 配置文件的加载顺序

        Struts-default.xml---> struts-plugin.xml--> struts.xml-->   struts.properties--> web.xml

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

    1)

    Struts2 默认是支持/* 和 *.action的匹配,配置如下:

     

    Web.xml

     

       <filter-mapping>

          <filter-name>struts2</filter-name>

          <url-pattern>/*</url-pattern>

       </filter-mapping>

     

    或者

     

       <filter-mapping>

          <filter-name>struts2</filter-name>

          <url-pattern>/*</url-pattern>

          <url-pattern>*.action</url-pattern>

          <url-pattern>*.do</url-pattern>

       </filter-mapping>

     

    struts.xml

    及其他配置文件中不能指定

     

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

    struts.action.extension属性

     

    假如:

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

     

    属性一旦被指定,只能匹配指定的后缀请求。

     

    2)同时支持/*,*.action *.do的请求

     

    修改struts2-core-2.2.3.jar包中的orgapachestruts2目录下的default.properties 文件中的

    struts.action.extension=action,,

    struts.action.extension=action,do,

     

    web.xml中

    <filter-mapping>

          <filter-name>struts2</filter-name>

          <url-pattern>/*</url-pattern>

          <url-pattern>*.action</url-pattern>

          <url-pattern>*.do</url-pattern>

       </filter-mapping>

  • 相关阅读:
    shell——变量
    xxx is not in the sudoers file.This incident will be reported.的解决方法
    百度面试回忆
    iOS网络协议 HTTP/TCP/IP浅析
    使用xib封装一个自定义view的步骤
    修改了系统自带头文件后,Xcode会报错
    字典转模型规范化
    文本属性Attributes
    苹果API常用英语名词
    命令行 -- 命令"%cd%"
  • 原文地址:https://www.cnblogs.com/liangbo-/p/7307145.html
Copyright © 2011-2022 走看看