예제 #1
0
 public void update() {
   boolean flag = false;
   String id = request.getParameter("id");
   MessageComment messageComment = getMessageComment();
   try {
     messageComment.setId(Long.valueOf(id));
     messageCommentService.saveEntity(messageComment);
     flag = true;
     super.reponseWriter(JSON.toJSONString(flag));
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
예제 #2
0
  /** 查询主页 */
  public void query() {
    messageid = Long.parseLong(request.getParameter("messageid"));
    String page = request.getParameter("page"); // 当前页数
    String rows = request.getParameter("rows"); // 每页显示行数

    try {
      MessageComment messageComment = new MessageComment();
      messageComment.setMessageid(messageid);
      Pager pager =
          messageCommentService.queryMessageCommentByPage(
              messageComment, Integer.valueOf(rows), Integer.valueOf(page));
      super.reponseWriter(JSON.toJSONString(pager));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #3
0
  public String save() {
    boolean flag = false;
    MessageComment messageComment = getMessageComment();

    try {
      messageCommentService.saveEntity(messageComment);
      bbsMessageQuery = bbsMessageService.findBBSMessageQuery(messageComment.getMessageid());
      commentslist = bbsMessageService.queryCommentsByMsgId(messageComment.getMessageid());
      flag = true;
      super.reponseWriter(JSON.toJSONString(flag));
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "bbs_detail";
  }
예제 #4
0
  public MessageComment getMessageComment() {
    String messageid = request.getParameter("messageid");
    String commentctx = request.getParameter("commentctx");
    Map<String, Object> session = context.getSession();
    User sessionuser = (User) session.get("user");
    MessageComment bbsMessage = new MessageComment();
    bbsMessage.setMessageid(Long.parseLong(messageid));
    bbsMessage.setCommentctx(commentctx);
    bbsMessage.setCommenttime(new Date());
    if (sessionuser == null) {
      bbsMessage.setUserid("");
    } else {
      bbsMessage.setUserid(sessionuser.getUserid());
    }

    return bbsMessage;
  }