首页 > 代码库 > Struts2中的action
Struts2中的action
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
<action name="hello" class="structs_my_action.HelloAction" method="sayhello">
<result name="ok">/Struts2/suc.jsp</result>
</action>
</package>
<package name="customer" namespace="/" extends="struts-default">
<action name="save_cus" class="Customer.Mycustomer" method="save"></action>
<action name="delete_cus" class="Customer.Mycustomer" method="delete"></action>
<action name="lilang_*" class="lilang_struts.Data" method="{1}"></action>
</package>
</struts>
package lilang_struts;
import com.opensymphony.xwork2.ActionSupport;
public class Data extends ActionSupport{
/**
* 保存客户
* @return
*/
public String save(){
System.out.println("save");
return NONE;
}
/**
* 删除客户
* @return
*/
public String delete(){
System.out.println("delete");
return NONE;
}
}
Struts2中的action