<package name="default" namespace="/" extends="struts-default"> <action name="hellowrold_*" method="{1}" class="cn.HelloWroldaction"> <result>/result.jsp</result> <result name="add">/{1}.jsp</result> <result name="update">/{1}.jsp</result> </action> </package>
package cn; import com.opensymphony.xwork2.ActionSupport; @SuppressWarnings("serial") public class HelloWroldaction extends ActionSupport { public String add(){ return SUCCESS; } public String update(){ return "update"; } @Override public String execute() throws Exception { // TODO Auto-generated method stub System.out.println("action is start!"); return "fail"; } }
public String add(){
return SUCCESS;
}
return success 改成 “add”不然执行的是<result>/result.jsp</result>
add方法返回"add"也没用,我明明有add方法啊,为什么说找不到