<package<wbr><wbr>name=</wbr></wbr>"actions"<wbr><wbr></wbr></wbr>extends="struts-default"<wbr><wbr>namespace=</wbr></wbr>"/actions"> <wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>&lt;action<wbr><wbr>name=</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>"Student*"<wbr><wbr></wbr></wbr>class="com.bjsxt.struts2.action.StudentAction"<wbr><wbr>method=</wbr></wbr>"{1}"> <wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>&lt;result&gt;/Student{</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>1}_success.jsp</result> <wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>&lt;/action&gt; <wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>

</package><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>

struts2的配置文件还可以更加简洁,即在action的class中使用通配符,如下:



Java代码 ​​ ​

<package<wbr><wbr>name=</wbr></wbr>"actions"<wbr><wbr></wbr></wbr>extends="struts-default"<wbr><wbr>namespace=</wbr></wbr>"/actions"> <wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr>&lt;action<wbr><wbr>name=</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>"*_*"<wbr><wbr></wbr></wbr>class="com.bjsxt.struts2.action.{1}Action"<wbr><wbr>method=</wbr></wbr>"{2}"> <wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>&lt;result&gt;/{</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>1}_{2}_success.jsp</result><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>&lt;/action&gt;<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>

<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>&lt;/</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>package><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>