if("add".equals(method)){
String postName=request.getParameter("postName");
String postMemo=request.getParameter("postMemo");
String createTime=request.getParameter("createTime");
if(new TbPostDAO().add(new TbPost(postName,postMemo,createTime))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbPostList",new TbPostDAO().getTbPostAll());
response.sendRedirect("PostModule/TbPostList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_Post", "PostId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbPostList",new TbPostDAO().getTbPostAll());
response.sendRedirect("PostModule/TbPostList.jsp");
}
if("edit".equals(method)){
int postId=Integer.parseInt(request.getParameter("postId"));
String postName=request.getParameter("postName");
String postMemo=request.getParameter("postMemo");
String createTime=request.getParameter("createTime");
if(new TbPostDAO().add(new TbPost(postId,postName,postMemo,createTime))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbPostList",new TbPostDAO().getTbPostAll());