</pre><p></p><h1><span style="color:#ff0000;">第一种方式:</span></h1><p><em><strong><span style="color:#993399;">基本数据类型:</span></strong></em></p><p><em><strong><span style="color:#993399;"></span></strong></em></p><p><em></em><pre name="code" class="java" style="color: rgb(51, 51, 255);"> private String userName;
private String password;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
JavaBean类型:
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
第二种方式:
import com.opensymphony.xwork2.ModelDriven;
private User user=new User();
@Override
public User getModel() {
return user;
}