struts2 修改后缀名或去掉后缀名的方法

 

方法1:将配置文件中加入以下代码就OK了

<struts>

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

    <package name="s2" extends="struts-default">

    <action name="x" class="com.Action.Forward">

    <result>/index.jsp</result>

    <result name="show">/show.jsp</result>

    <result name="fail">/fail.jsp</result>

    </action>

   

   <action name="autocomplete" class="com.Action.AutoComplete">

      </action>

     

    <action name="r" class="com.Action.Register">

       <result>/index.jsp</result>

       <result name="errors">/register.jsp</result>

    </action>

    </package>

</struts>

方法2:

或者直接找到struts2-core-2.1.81.jar

org.apache.struts2下的default.properties

修改struts.action.extension=action,,   在这个逗号以后随便添加你想要的后缀名

但这里是有顺序的因为在form表单中只需写入控制器的映射名字他就会给你自动填写后缀名

所以把你想要的后缀名写在最前头(这样写表示就是不要后缀名)

如:struts.action.extension=,action,do,  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值