前面已經(jīng)提到择示,配置<action.../>元素時可以不指定class屬性,如果沒有指定class屬性晒旅,則系統(tǒng)默認(rèn)使用ActionSupport類作為Action處理類栅盲。
實(shí)際上,Struts2允許開發(fā)者定義Action的默認(rèn)處理類废恋,配置Action的默認(rèn)處理類使用<default-class-ref .../>元素谈秫,配置該元素時只需指定一個class屬性,該class屬性指定的類就是Action的默認(rèn)處理類鱼鼓。
在struts2-core-2.2.1.1.jar壓縮包的struts-default.xml文件中有如下配置片段:
<package name="struts-default" abstract="true">
...
<!-- 配置Action的默認(rèn)處理類 -->
<default-class-ref class="com.opensymphony.xwork2.ActionSupport" />
</package>