<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <!-- 将.action访问,改为.do、.doaction:同时处理这两种后缀 --> <constant name="struts.action.extension" value="do,doaction"></constant> <package name="hw" namespace="/test" extends="struts-default"> <action name="helloworld" class="com.self.action.HelloWorldAction" method="dohelloworld" > <result name="doresult"> /showresult.jsp </result> </action> </package> </struts>
原访问地址:http://localhost:8080/Struts2_01/test/helloworld.action(改后访问404)
该后地址01:http://localhost:8080/Struts2_01/test/helloworld.do
该后地址02:http://localhost:8080/Struts2_01/test/helloworld.doaction