struts2修改默認后綴

2018-01-03 13:29 更新

struts2修改默認后綴的3種方法 -= 方法一:在web.xml中配置

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  3. <filter>
  4. <filter-name>struts2</filter-name>
  5. <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  6. <init-param>
  7. <param-name>struts.action.extension</param-name>
  8. <param-value>action,do,</param-value>
  9. </init-param>
  10. </filter>
  11. <filter-mapping>
  12. <filter-name>struts2</filter-name>
  13. <url-pattern>/*</url-pattern>
  14. </filter-mapping>
  15. </web-app>

方法二:在struts.xml中配置

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE struts PUBLIC
  3. "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  4. "http://struts.apache.org/dtds/struts-2.3.dtd">
  5. <struts>
  6. <constant name="struts.action.extension" value="do,action,"></constant>
  7. <package name="default" namespace="/" extends="struts-default">
  8. </package>
  9. </struts>

方法三:在struts.properties中配置

struts.action.extension=do,action,,

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號