package com.iot.agchen.action;
import java.util.List;
import com.iot.agchen.bean.User;
import com.iot.agchen.dao.UserDao;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
public String save() throws Exception {
User u = new User();
u.setAge(age);
u.setUsername(username);
userDao.save(u);
return list();
}
public String list() throws Exception {
userList = userDao.list();
return INPUT;
}
private String username;
private int age;
private UserDao userDao;
private List userList; // 界面中显示的用户列表
public List getUserList() {
return userList;
}
public void setUserList(List userList) {
this.userList = userList;
}
public UserDao getUserDao() {
return userDao;
}
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
评论30
最新资源