struts2的默认扩展名是action,如果想修改默认扩展名,需要修改strcts.xml配置
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <include file="struts-default.xml"/> <package name="struts2_login" extends="struts-default" namespace="/login"> <action name="checkLogin" class="actions.LoginAction" method="checkLogin"> <result name="success">/index.jsp</result> <result name="login">/login.jsp</result> </action> </package> <constant name="struts.action.extension" value="shtml" /> </struts>
添加<constant name="struts.action.extension" value="shtml"/>
如果配置为不用扩展名则需要使用扩展包,具体描述在此