struts2配置后缀

来源:互联网 发布:用mac怎么在优酷下视频 编辑:程序博客网 时间:2024/05/22 05:00

3种方式:

1.在src目录下创建struts.properties文件,写以下内容

struts.action.extension=do

2.在struts.xml中配置常量标签

3.在web.xml中加init-param

    <filter>        <filter-name>struts2</filter-name>        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>        <init-param>            <param-name>struts.action.extension</param-name>            <param-value>do</param-value>        </init-param>    </filter>

3种方式配置后缀的优先级:

web.xml > struts.properties文件 > struts.xml
一般把这种常量放在struts.xml中配置