两种方式修改struts2的访问路径以.do为结尾的方式

struts2的核心包中找到:org.apache.struts2.default.properties中找到
### Used by the DefaultActionMapper
### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
### The blank extension allows you to match directory listings as well as pure action names
### without interfering with static resources.
struts.action.extension=action,,

### Used by FilterDispatcher
### If true then Struts serves static content from inside its jar.
### If false then the static content must be available at <context_path>/struts


第一种:可以在struts.xml的配置文件中这样添加
<struts>

	<constant name="struts.action.extension" value="do"/>
	
	<package name="myLogin" namespace="/login" extends="struts-default">
		<action name="login" class="" method="">
			<result name="success" type="dispatcher">/login.jsp</result>
		</action>
	</package>
</struts>


可是如果要修改的属性比较多就有点不好了。
第二种:
在src目录下,单独写一个struts.properties的文件:内容如下

struts.action.extension=do


这样以后访问就以.do为结尾的路径请求了!!!

你可能感兴趣的:(apache,xml,jsp,struts)