1.普通java类
package com.ahd.action; public class HelloAction{
public String execute() throws Exception {
return "SUCCESS";
}
}
注意事项,必须要有公有的返回值为字符串的execute方法,返回值可以参考Action接口
2.继承ActionSupport类
package com.ahd.action; import com.opensymphony.xwork2.ActionSupport; public class HelloAction extends ActionSupport{
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return "SUCCESS";
}
}
3.实现Action接口
package com.ahd.action; import com.opensymphony.xwork2.Action; public class HelloAction implements Action{
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return Action.SUCCESS;
}
}