public BBSMessage getBBSMessage() { String title = request.getParameter("title"); String content = request.getParameter("content"); Map<String, Object> session = context.getSession(); User sessionuser = (User) session.get("user"); BBSMessage bbsMessage = new BBSMessage(); bbsMessage.setTitle(title); bbsMessage.setContent(content); bbsMessage.setUserid(sessionuser.getUserid()); bbsMessage.setCreateTime(new Date()); return bbsMessage; }
public String queryBBSMessageDetail() { super.commonQuery(); String id = request.getParameter("id"); try { bbsMessageQuery = bbsMessageService.findBBSMessageQuery(Long.parseLong(id)); BBSMessage bbs = new BBSMessage(); bbs.setId(bbsMessageQuery.getId()); bbs.setContent(bbsMessageQuery.getContent()); bbs.setCreateTime(bbsMessageQuery.getCreateTime()); bbs.setScannum(bbsMessageQuery.getScannum() + 1); bbs.setTitle(bbsMessageQuery.getTitle()); bbs.setUserid(bbsMessageQuery.getUserid()); bbsMessageService.saveEntity(bbs); commentslist = bbsMessageService.queryCommentsByMsgId(Long.parseLong(id)); } catch (NumberFormatException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return "bbs_detail"; }