01_6_Struts_ActionWildcard_通配符配置
阿新 • • 發佈:2018-03-26
ring result nta public res add space uid 文件
01_6_Struts_ActionWildcard_通配符配置
1.Struts_ActionWildcard_通配符配置
1.1配置struts.xml文件
<package name="student" namespace="/actions" extends="struts-default">
<action name="student*" class="com.sumapay.action.StudentAction" method="{1}">
<result>
/Student_{1}_success.jsp
</result>
</action>
<!-- 下面配置通配
<action name="*_*" class="com.sumapay.action.{1}Action" method={2}>
<result>
/{1}_{2}_success.jsp
</result>
</action>
-->
</package>
1.2配置action類繼承ActionSupport
package com.sumapay.action;
import com.opensymphony.xwork2.ActionSupport;
public class StudentAction extends ActionSupport {
private static final long serialVersionUID = 1L;
public String add() {
return "success";
}
public String delete() {
return "success";
}
}
01_6_Struts_ActionWildcard_通配符配置