input.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>通过通配符方法访问</h1>
<a href="customer_find">查询客户</a><br>
<a href="customer_delete">删除客户</a><br>
<a href="customer_update">更新客户</a><br>
<a href="customer_save">保存客户</a><br>
</body>
</html>
struts.xml
<action name="customer_*" class="Action.customer" method="{1}">
<allowed-methods>delete,update,find,save</allowed-methods>
</action>
customer.java
package Action;
import com.opensymphony.xwork2.ActionSupport;
public class customer extends ActionSupport {
public String find() {
System.out.println("查询用户");
return null;
}
public String delete() {
System.out.println("删除用户");
return null;
}
public String update() {
System.out.println("更新用户");
return null;
}
public String save() {
System.out.println("保存用户");
return null;
}
}