首页>代码>struts2.3+hibernate4.1+spring3.2+EasyUI1.36整合实现的java后台管理系统>/ADP/src/com/edianxun/adp/action/ManagerAction.java
package com.edianxun.adp.action; /** * @author lhr * @date 2014-4-30 */ import java.util.Map; import org.apache.log4j.Logger; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import com.edianxun.adp.pojo.Manager; import com.edianxun.adp.service.ManagerService; import com.opensymphony.xwork2.ModelDriven; @Results({@Result(name="main",location="/jsp/main.jsp",type="redirect")}) public class ManagerAction extends BaseAction implements ModelDriven<Manager>{ private static final long serialVersionUID = -1040088992400395429L; private static final Logger logger = Logger.getLogger(ManagerAction.class); private Manager manager = new Manager(); private ManagerService managerService; private String name; public void setManagerService(ManagerService managerService) { this.managerService = managerService; } public String execute(){ logger.debug("bingo"); return SUCCESS; } @Action("mgrlogin") public String login(){ Map<String, Object> session = getSession(); try { int managerId = managerService.loginValidate(manager); logger.debug("manager Id :" + managerId); if (managerId > 0) { session.put("managerId", managerId); session.put("manager", manager.getName()); }else { return LOGIN; } } catch (Exception e) { logger.debug("manager login exception"); e.printStackTrace(); } return "main"; } @Action("mgrlogout") public String logout(){ logger.debug("logout"); Map<String, Object> session = getSession(); session.remove("managerId"); session.remove("manager"); return null; } @Action("mgrlist") public void list(){ logger.debug("query all manager"); try { this.outJson(managerService.managerList()); } catch (Exception e) { e.printStackTrace(); } } @Action("mgradd") public void add(){ try { manager.setStatus("NORMAL"); int managerId = managerService.addManager(manager); logger.debug("managerId : " + managerId); if (managerId <= 0) { } } catch (Exception e) { e.printStackTrace(); } } @Action("mgrupdate") public void update(){ logger.debug("manager update password ..."); try { Map<String, Object> session = getSession(); int id = (Integer) session.get("managerId"); Manager man = managerService.getManager(id); man.setPassword(manager.getPassword()); managerService.update(man); this.outJson(man.getPassword()); } catch (Exception e) { e.printStackTrace(); } } @Action("mgrUpdateInfo") public void updateInfo(){ logger.debug("manager update info ..."); try { System.out.println("####" + manager.getDescrition()); managerService.update(manager); } catch (Exception e) { e.printStackTrace(); } } @Action("mgrdel") public void del(){ logger.debug("manager delete"); try { managerService.del(manager.getManagerId()); this.outJson("ok"); } catch (Exception e) { e.printStackTrace(); this.outJson("nok"); } } @Override public Manager getModel() { return manager; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
最近下载更多
17787885952 LV3
2022年5月5日
wanglinddad LV55
2022年4月14日
王燕燕 LV3
2021年12月23日
afei115 LV4
2021年11月20日
cailizhu833 LV2
2021年8月17日
Vera.Wu LV2
2021年5月29日
and123456 LV11
2021年4月20日
admin_z LV22
2021年4月18日
小屁孩 LV7
2021年4月11日
weijianjiao LV1
2021年3月14日
最近浏览更多
ruo12138 LV1
5月2日
educationAAA LV6
4月18日
Gin19960217 LV4
1月19日
aaabbbv
2023年12月17日
暂无贡献等级
WBelong LV7
2023年12月11日
lt12138 LV2
2023年10月25日
dsadasdwf LV12
2023年10月23日
1049066887 LV12
2023年10月21日
张朕朕 LV3
2023年9月8日
288984827 LV1
2023年8月25日