关于通配符的
<action name="4b.*" method="{1}" class="com.struts.Struts">
<result >/strutst2.jsp</result>
<result name="add">/add.jsp</result>
<result name="update">/update.jsp</result>
我这样写的,不管是访问4b.add.action还是4b.update.action都是跳到struts2.jsp这个页面
下面是java代码
package com.struts;
import java.awt.event.ActionEvent;
import com.opensymphony.xwork2.ActionSupport;
public class Struts extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
System.out.println("chixing");
return SUCCESS;
}
public String add(){
System.out.println("这是add方法");
return SUCCESS;
}
public String update(){
System.out.println("这是一个update方法");
return SUCCESS;
}
}