package com.action; import java.util.Date; import java.util.List; import java.util.Map; import org.apache.struts2.ServletActionContext; import com.dao.TGonggaoDAO; import com.model.TAdmin; import com.model.TGonggao; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class gonggaoAction extends ActionSupport { private int gonggaoId; private String gonggaoTitle; private String gonggaoContent; private String gonggaoData; private String gonggaoFabuzhe; private String message; private String path; private TGonggaoDAO gonggaoDAO; public String gonggaoAdd() { TGonggao gonggao=new TGonggao(); gonggao.setGonggaoTitle(gonggaoTitle); gonggao.setGonggaoContent(gonggaoContent); gonggao.setGonggaoData(new Date().toLocaleString()); gonggaoDAO.save(gonggao); this.setMessage("公告添加完毕"); this.setPath("gonggaoMana.action"); return "succeed"; } public String gonggaoMana() { List gonggaoList =gonggaoDAO.findAll(); Map request=(Map)ServletActionContext.getContext().get("request"); request.put("gonggaoList", gonggaoList); return ActionSupport.SUCCESS; } public String gonggaoDel() { TGonggao gonggao=gonggaoDAO.findById(gonggaoId); gonggaoDAO.delete(gonggao); this.setMessage("公告删除完毕"); this.setPath("gonggaoMana.action"); return "succeed"; } public String gonggaoDetail() { TGonggao gonggao=gonggaoDAO.findById(gonggaoId); Map request=(Map)ServletActionContext.getContext().get("request"); request.put("gonggao", gonggao); return ActionSupport.SUCCESS; } public String gonggaoDetailQian() { TGonggao gonggao=gonggaoDAO.findById(gonggaoId); Map request=(Map)ServletActionContext.getContext().get("request"); request.put("gonggao", gonggao); return ActionSupport.SUCCESS; } public String gonggaoQian5() { List gonggaoList=gonggaoDAO.findAll(); if(gonggaoList.size()>5) { gonggaoList=gonggaoList.subList(0, 5); } Map request=(Map)ServletActionContext.getContext().get("request"); request.put("gonggaoList", gonggaoList); return ActionSupport.SUCCESS; } public String getGonggaoContent() { return gonggaoContent; } public void setGonggaoContent(String gonggaoContent) { this.gonggaoContent = gonggaoContent; } public TGonggaoDAO getGonggaoDAO() { return gonggaoDAO; } public void setGonggaoDAO(TGonggaoDAO gonggaoDAO) { this.gonggaoDAO = gonggaoDAO; } public String getGonggaoData() { return gonggaoData; } public void setGonggaoData(String gonggaoData) { this.gonggaoData = gonggaoData; } public String getGonggaoFabuzhe() { return gonggaoFabuzhe; } public void setGonggaoFabuzhe(String gonggaoFabuzhe) { this.gonggaoFabuzhe = gonggaoFabuzhe; } public int getGonggaoId() { return gonggaoId; } public void setGonggaoId(int gonggaoId) { this.gonggaoId = gonggaoId; } public String getGonggaoTitle() { return gonggaoTitle; } public void setGonggaoTitle(String gonggaoTitle) { this.gonggaoTitle = gonggaoTitle; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } }

angaochong LV5
2024年10月21日
wanglinddad LV55
2022年4月1日
ericxu1116 LV24
2021年6月16日
995591560 LV3
2021年6月6日
皓腕凝霜雪 LV2
2021年5月9日
YiRenHun LV11
2021年4月11日
浴皇大帝 LV8
2021年3月22日
jinandfei LV12
2021年3月17日
clwy0617 LV2
2021年2月11日
835512308 LV14
2020年12月20日