package action; import java.util.List; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.struts2.json.annotations.JSON; import model.Users; import com.opensymphony.xwork2.ActionSupport; import dao.BaseDao; public class UsersAction extends ActionSupport { Users users; BaseDao baseDao; List<Users> userList; private JSONArray rows; private String result; private int total = 0; public JSONArray getRows() { return rows; } public void setRows(JSONArray rows) { this.rows = rows; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public int getTotal() { return total; } public void setTotal(int total) { this.total = total; } @JSON(serialize = false) public List<Users> getUserList() { return userList; } @JSON(serialize = false) public void setUserList(List<Users> userList) { this.userList = userList; } @JSON(serialize = false) public Users getUsers() { return users; } @JSON(serialize = false) public void setUsers(Users users) { this.users = users; } @JSON(serialize = false) public BaseDao getBaseDao() { return baseDao; } @JSON(serialize = false) public void setBaseDao(BaseDao baseDao) { this.baseDao = baseDao; } @SuppressWarnings("unchecked") public String login() { if (this.users == null) { return LOGIN; } if (baseDao.loginByExample(users) == null) { return LOGIN; } return SUCCESS; } @SuppressWarnings("unchecked") public String getAllUser() { System.out.println("-----------------正在查询所有用户-----------------"); userList = baseDao.queryByHql("from Users"); this.setRows(JSONArray.fromObject(userList)); this.setTotal(userList.size()); System.out.println(("[total]:" + total + "[rows]:" + rows)); return "root"; } }
最近下载更多
微信网友_6374390005878784 LV1
2023年3月4日
and123456 LV11
2022年5月7日
waterlq LV1
2021年3月27日
Dream shadow LV9
2020年12月15日
李兰香 LV11
2019年12月28日
jeep123456 LV10
2019年7月5日
wxy123 LV2
2019年6月18日
傻傻的琪默 LV2
2019年5月8日
TMingMin LV10
2019年3月9日
ws760823 LV8
2019年3月8日