package com.zx.test.view.struts2.action;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.log4j.Logger;
import com.zx.test.model.entity.Message;
import com.zx.test.model.service.MessageService;
public class MessageAction extends ActionSupport {
private long id;
private MessageService messageService;
private Message message;
private List<Message> messages;
// 分页
private Integer pageNum = 0;
private Integer allPages;
private Integer allCounts = 0;
static Logger logger = Logger.getLogger(MessageAction.class);
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getAllPages() {
return allPages;
}
public void setAllPages(Integer allPages) {
this.allPages = allPages;
}
public Integer getAllCounts() {
return allCounts;
}
public void setAllCounts(Integer allCounts) {
this.allCounts = allCounts;
}
public MessageService getMessageService() {
return messageService;
}
public void setMessageService(MessageService messageService) {
this.messageService = messageService;
}
public Message getMessage() {
return message;
}
public void setMessage(Message message) {
this.message = message;
}
public List<Message> getMessages() {
return messages;
}
public void setMessages(List<Message> messages) {
this.messages = messages;
}
public String regist() throws Exception {
try {
messageService.regist(message);
return SUCCESS;
} catch (RuntimeException e) {
e.printStackTrace();
return ERROR;
}
}
public String getAll() throws Exception {
try {
if (pageNum == 0)
pageNum = 1;
int count = 3;
int start = count * (pageNum - 1);
allCounts = messageService.getAllcounts();
allPages = (allCounts + count - 1) / count;
messages = messageService.getAll(start,count);
return SUCCESS;
} catch (RuntimeException e) {
e.printStackTrace();
return ERROR;
}
}
public String remove() throws Exception {
try {
messageService.delete(id);
return SUCCESS;
} catch (Exception e) {
logger.info("系统忙,请稍候再试!",e);
return ERROR;
}
}
public String logout() throws Exception {
ServletActionContext.getRequest().getSession().invalidate();
return SUCCESS;
}
public String update() throws Exception {
try {
/*String mid = ServletActionContext.getRequest().getParameter("id");
long id = (long)Long.parseLong(mid);
String bianhao = ServletActionContext.getRequest().getParameter("message.MBianhao");
String name = ServletActionContext.getRequest().getParameter("message.NName");
String value = ServletActionContext.getRequest().getParameter("message.NValue");
String desc = ServletActionContext.getRequest().getParameter("message.NDesc");
message.setId(id);
message.setMBianhao(bianhao);
message.setNName(name);
message.setNValue(value);
message.setNDesc(desc);*/
messageService.update(message);
return SUCCESS;
} catch (RuntimeException e) {
e.printStackTrace();
return ERROR;
}
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
S2SH练习项目struts2 spring hibernate (116个子文件)
MessageAction.class 4KB
MemberAction.class 3KB
MessageDaoImp.class 2KB
NumbersDaoImp.class 2KB
FenYeTaglib.class 2KB
Message.class 2KB
MessageServiceImp.class 2KB
NemberServiceImp.class 1KB
BaseDao.class 1KB
Numbers.class 1KB
BaseAction.class 969B
TestUserNotExistException.class 703B
TestPwdErrorException.class 691B
TestRunTimeException.class 688B
MessageService.class 426B
MessageDao.class 414B
NemberService.class 361B
NembersDao.class 196B
.classpath 4KB
Test_End.iml 2KB
Test_End.ipr 13KB
Test_End.iws 24KB
spring.jar 2.56MB
struts2-core-2.0.11.jar 2.22MB
hibernate3.jar 2.15MB
classes12.jar 1.14MB
xerces-2.6.2.jar 987KB
freemarker-2.3.8.jar 784KB
standard.jar 476KB
javassist.jar 460KB
xwork-2.0.1.jar 442KB
antlr-2.7.6.jar 433KB
log4j-1.2.11.jar 342KB
c3p0-0.8.4.5.jar 340KB
dom4j-1.6.1.jar 307KB
cglib-2.1.3.jar 276KB
hibernate-annotations.jar 259KB
jaxen-1.1-beta-7.jar 222KB
ehcache-1.2.3.jar 203KB
commons-lang.jar 203KB
commons-collections-2.1.1.jar 171KB
ognl-2.6.11.jar 164KB
xml-apis.jar 121KB
commons-validator-1.3.0.jar 117KB
commons-beanutils-1.6.jar 116KB
hibernate-entitymanager.jar 114KB
commons-digester.jar 107KB
commons-io-1.4.jar 106KB
commons-dbcp.jar 105KB
jaas.jar 102KB
spring-mock.jar 102KB
commons-pool.jar 95KB
commons-chain-1.1.jar 88KB
hibernate-commons-annotations.jar 65KB
oro-2.0.8.jar 64KB
jakarta-oro.jar 64KB
hibernate-validator.jar 60KB
commons-fileupload-1.2.1.jar 56KB
commons-logging-1.0.4.jar 37KB
asm.jar 26KB
saxpath.jar 23KB
jstl.jar 20KB
asm-attrs.jar 16KB
spring-aspects.jar 11KB
struts2-pell-multipart-plugin-2.0.11.jar 9KB
jta.jar 9KB
struts2-spring-plugin-2.0.6.jar 8KB
jdbc2_0-stdext.jar 7KB
MessageAction.java 3KB
MemberAction.java 2KB
MessageDaoImp.java 1KB
Message.java 1KB
FenYeTaglib.java 1KB
NemberServiceImp.java 964B
MessageServiceImp.java 928B
Numbers.java 826B
NumbersDaoImp.java 745B
BaseDao.java 684B
BaseAction.java 536B
MessageService.java 452B
MessageDao.java 402B
NemberService.java 342B
TestUserNotExistException.java 333B
TestPwdErrorException.java 317B
TestRunTimeException.java 311B
NembersDao.java 269B
MessageList.jsp 3KB
update.jsp 3KB
regist.jsp 2KB
login.jsp 2KB
welcome.jsp 1010B
error.jsp 934B
MANIFEST.MF 39B
.myhibernatedata 473B
.mymetadata 298B
com.genuitec.eclipse.j2eedt.core.prefs 1KB
.project 2KB
log4j.properties 450B
struts.properties 28B
struts.properties 28B
共 116 条
- 1
- 2
资源评论
JerryZhou_
- 粉丝: 118
- 资源: 24
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Python使用递归和动态规划解决背包问题.zip
- 从0开始建立dSPACE RT Simulink工程:CAN通信(Bus Manager方法)DBC
- 轮胎X光缺陷检测数据集VOC+YOLO格式1903张4类别.zip
- 基于Matlab和遗传算法解决组合优化背包问题.zip
- mycode.asm
- 基于Python和粒子群算法解决01背包问题并进行可视化.zip
- Qt/qt creator实现TCP通信,多线程实现服务器的并发(server/client)
- Qt/qt creator实现TCP通信,多线程实现服务器的并发(server/client)
- IMG_20240510_083752.jpg
- 中兴R5300G4 BIOS&BMC 最新版本 24年5月
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功