<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> <struts> <!--struts是以包管理的,extends指定该action继承的类 --> <package name="action" extends="struts-default" > <!--action中的name是对应请求路径,class对应处理该请求的类 --> <action name="hello_*" class="my.action.HelloAction" method="{1}"> <!-- result对应返回值 ,type,重定向或者转发 --> <result name="success" type="dispatcher">/success.jsp</result> <result name="failure" type="dispatcher">/failure.jsp</result> <!-- 版本导致,2.5版本会验证,不指定方法时会报错,找不到映射路径对应的方法 --> <!-- <allowed-methods>make,say</allowed-methods> --> <allowed-methods>*</allowed-methods> </action> </package> </struts>