The spring mvc object inherits the properties of the parent class of the receiving end receives the attribute value is always null, why the network processing pojo passing objects?

// =========================== Case 1: ================== =============
// the class objects transfer User1 info on the network property value to the other end of the network can receive!

public class User1 implements Serializable {
  public String info = null;
  public String userName = null;
  public String userPWD = null;
}

// ============================ Case 2: ================= ==============

public class BaseInfo {
  public String info = null;
}

// class objects when passing User2 info on the network property value received at another network end value is always null!

public class User2 extends BaseInfo implements Serializable {
  public String userName = null;
  public String userPWD = null;
}

// ============================ Case 3: ================= ==============

public class BaseInfo2 implements Serializable {
  public String info = null;
}

info info value obtained attribute value received at the other end of the network when transmitting User2 // class objects on the network!

public class User3 extends BaseInfo2 implements Serializable {
  public String userName = null;
  public String userPWD = null;
}

// ** just do not know subclass has been achieved serialization, why the parent class is also necessary to be able to achieve a sequence of transmission on the network do? **

 

Because there is no written get set, springmvc reflection set properties not set

 

Guess you like

Origin www.cnblogs.com/yuhuameng/p/11293754.html