Struts2 action的扩展名两种修改方法
STRUTS2 ACTION的扩展名默认为.action,在struts1.X前为.do,如果要把STRUTS2的ACTION 的扩展名也改成.do可以按如下方法做。
方法一
struts.xml:
方法一
struts.xml:
<
struts
>
< constant name ="struts.action.extension" value ="do" /> //注意这里
< package name ="default" extends ="struts-default" namespace ="/example" >
< action name ="HelloWord" class ="example.HelloWord" >
< result name ="SUCCESS" > /example/HelloWord.jsp </ result >
</ action >
</ package >
<!--
<include file="example.xml"/>
-->
<!-- Add packages here -->
</ struts >
< constant name ="struts.action.extension" value ="do" /> //注意这里
< package name ="default" extends ="struts-default" namespace ="/example" >
< action name ="HelloWord" class ="example.HelloWord" >
< result name ="SUCCESS" > /example/HelloWord.jsp </ result >
</ action >
</ package >
<!--
<include file="example.xml"/>
-->
<!-- Add packages here -->
</ struts >
方法二:
web.xml
给filter加个init-param
<
init-param
>
< param-name > struts.action.extension </ param-name >
< param-value > do </ param-value >
</ init-param >
< param-name > struts.action.extension </ param-name >
< param-value > do </ param-value >
</ init-param >