- <?xml version = "1.0" encoding = "UTF-8"?>
- <!--下面是Struts2配置文件的DTD信息 -->
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
- <!--struts是struts2配置文件的跟元素 -->
- <struts>
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <constant name="" value="" />
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <bean type="" name="" class="" scope="" static="" optional="" />
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <include file="" />
- <!--package元素是struts配置文件的核心,该元素可以出现0次,或者是无限多次 -->
- <package name="必填的包名" extends="" namespace="" abstract="" externalReferenceResovler>
- <!--以下该元素可以出现,也可以不出现,最多出现一次 -->
- <result-types>
- <!--以下该元素必须出现,可以出现无数多次 -->
- <result-type name="" class="" default="true\false">
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值 </param>
- </result-type>
- </result-types>
- <!--以下的该元素可以出现,也可以不出现,但最多出现1次 -->
- <interceptors>
- <!--interceptors元素的子元素interceptor元素和interceptor-stack至少出现其中之一,也可以两者都出现 -->
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <interceptor name="" class="">
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值 </param>
- </interceptor>
- <!--下面的元素可以出现0次,也可以出现无限多次 -->
- <interceptor-stack name="">
- <!-- 下面的元素必须出现,可以出现无数多次 -->
- <interceptor-ref name="">
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </interceptor-ref>
- </interceptor-stack>
- </interceptors>
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <default-interceptor-ref name="">
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </default-interceptor-ref>
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <default-action-ref name="">
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </default-action-ref>
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <global-results>
- <!-- 该元素必须出现,可以出现无限多次 -->
- <result name="" type="">
- <!-- 该字符串内容可以出现0次或者多次 -->
- 映射资源
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </result>
- </global-results>
- <!-- 下面的元素可以出现0次,也可以出现多次 -->
- <global-exception-mappings>
- <!-- 该元素必须出现,可以出现多次 -->
- <exception-mapping name="" exception="" result="">
- 异常处理资源
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </exception-mapping>
- </global-exception-mappings>
- <action name="" class="" method="" convertor="">
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <result name="" type="">
- 映射资源
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </result>
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <interceptor-ref name="">
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </interceptor-ref>
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <exception-mapping name="" exception="" result="">
- 异常处理资源
- <!-- 下面的元素可以出现0次,也可以出现无限多次 -->
- <param name="参数名">参数值</param>
- </exception-mapping>
- </action>
- </package>
- </struts>