package com.ssh2.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
import com.ssh2.dao.UserDao;
import com.ssh2.model.PageBean;
import com.ssh2.model.User;
public class UserAction {
private String message;
private UserDao ud;
private User user;
private int page;
private PageBean pageBean;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public UserDao getUd() {
return ud;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public void setUd(UserDao ud) {
this.ud = ud;
}
public String login(){
if(ud.login(user)){
Map session = ActionContext.getContext().getSession();
session.put("user", user);
return "login";
}
else{
this.setMessage("µÇ¼ʧ°Ü£¡");
return "fail";
}
}
public String add(){
ud.add(user);
return "suc";
}
public String list(){
List list = ud.getUser();
ServletActionContext.getRequest().setAttribute("list", list);
return "suc";
}
public String delete(){
ud.delete(user.getId());
return "list";
}
public String getUserById(){
user = ud.getUser(user.getId());
ServletActionContext.getRequest().setAttribute("list", user);
return "suc";
}
public String update(){
ud.update(user);
return "list";
}
public String queryForPage(){
this.pageBean = ud.queryForPage(2, page);
return "suc";
}
}
最近下载更多
ming_123_9715 LV23
2022年12月14日
PaymentCodeSystem LV11
2022年10月28日
gxlgxl LV4
2022年5月27日
漫长的白日梦 LV8
2021年12月4日
GD_chan LV5
2021年7月1日
lsglsg9 LV23
2021年1月7日
管子769431178 LV3
2020年6月6日
x1012786954 LV8
2020年6月4日
445507541 LV1
2020年6月2日
liwulong LV2
2020年5月19日
最近浏览更多
wanderingsoul LV2
2024年6月15日
微信网友_5986558820093952 LV4
2023年12月28日
lbsers LV5
2023年5月8日
3516569014 LV5
2023年5月7日
女王不该在山炮村养花 LV8
2023年4月13日
ming_123_9715 LV23
2022年12月13日
PaymentCodeSystem LV11
2022年10月28日
gxlgxl LV4
2022年5月27日
qqb123 LV8
2022年5月26日
阿达阿发爱国 LV1
2021年12月14日

