struts2开发action 的三种方法

1、继承ActionSupport

public class UserAction extends ActionSupport {

    // Action中业务处理方法
    public String login() {
        System.out.println("UserAction.login()");
//      return "success";
        return SUCCESS;
    }
}

 

 

2、实现Action

public class UserAction3 implements Action {

    // Action中业务处理方法
    public String login() {
        System.out.println("UserAction.login()");
        return "success";
    }

    @Override
    public String execute() throws Exception {
        return null;
    }
}

 

 

3、既不继承也不实现任何的方法

public class UserAction {

    private String userName;
    public void setUserName(String userName) {
        this.userName = userName;
    }


    // Action中业务处理方法
    public String login() {
        System.out.println("UserAction.login()" + userName);
        return "login";
    }

    public String register() {
        System.out.println("register()" + userName);
        return "register";
    }
}

 

 

struts2开发action 的三种方法以及通配符、路径匹配原则、常量
struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量 
动态方法调用

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

struts2开发action 的三种方法以及通配符、路径匹配原则、常量

相关文章:

  • 2021-09-30
  • 2021-07-08
  • 2021-05-07
  • 2022-12-23
  • 2021-09-03
  • 2021-11-09
  • 2022-01-29
猜你喜欢
  • 2021-08-15
  • 2021-10-30
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案