方法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,