前言:

前面已经有一篇随笔介绍了Struts2的大概原理。本文就Struts2中Action与jsp页面进行数据对接时介绍几种常见方法!

 

  1. 值栈ValueStackStruts中Action三种接收参数的方式?

  2. 3个Action 

    Action1

    package com.gdufe.action;
    
    import com.opensymphony.xwork2.ActionSupport;
    
    /*
     * Action接收参数之后通过set方法赋给普通变量age,name;
     */
    public class UserAction1 extends ActionSupport{
        
        private int age;
        private String name;
        
        
        public int getAge() {
            return age;
        }
    
        public void setAge(int age) {
            this.age = age;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public String execute(){
            
            return SUCCESS;
        }
        
        public String test(){
            System.out.println(age +"|"+ name);
            return SUCCESS;
        }
    }
    View Code

相关文章:

  • 2021-11-20
  • 2022-12-23
  • 2021-08-09
  • 2021-09-02
  • 2021-08-18
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-15
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-07-13
  • 2022-03-09
  • 2021-11-03
相关资源
相似解决方案