实现action的三种方法

1.一个普通的类

public class testAction1 {
    public String execute(){
        return "success";
    }
}

2.实现Action接口

public class testAction2 implements Action {

    @Override
    public String execute() throws Exception {
        // TODO Auto-generated method stub
        return SUCCESS;//这个时候可以用SUCCESS,因为Action接口中有SUCCESS
    }

}

3.继承ActionSupport类

public class testAction3 extends ActionSupport {
    
    public String execute() throws Exception{
        return SUCCESS;//ActionSupport接口实现了Action类
    }

}

 

posted @ 2017-01-10 09:43  言凡  阅读(617)  评论(0编辑  收藏  举报