Example #1
0
 public void update() {
   boolean flag = false;
   String id = request.getParameter("id");
   BBSMessage bbsMessage = getBBSMessage();
   try {
     bbsMessage.setId(Long.valueOf(id));
     bbsMessageService.saveEntity(bbsMessage);
     flag = true;
     super.reponseWriter(JSON.toJSONString(flag));
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #2
0
  public void save() {
    boolean flag = false;
    BBSMessage bbsMessage = getBBSMessage();

    try {
      bbsMessage.setScannum(Long.parseLong("0"));
      bbsMessage.setIsessence(0);
      bbsMessageService.saveEntity(bbsMessage);
      flag = true;
      super.reponseWriter(JSON.toJSONString(flag));
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #3
0
 /**
  * 标记精华贴
  *
  * @throws IOException
  */
 public void essence() throws IOException {
   response.setHeader("Content-type", "text/html;chartset=utf8");
   response.setCharacterEncoding("utf8");
   PrintWriter out = response.getWriter();
   String id = request.getParameter("id");
   try {
     BBSMessage bbsMessage = bbsMessageService.findEntityById(Long.valueOf(id), BBSMessage.class);
     bbsMessage.setIsessence(1);
     bbsMessageService.saveEntity(bbsMessage);
     out.print("标记成功");
   } catch (NumberFormatException e) {
     e.printStackTrace();
     out.print("标记失败");
   } catch (Exception e) {
     e.printStackTrace();
     out.print("标记失败");
   } finally {
     out.flush();
     out.close();
   }
 }
Example #4
0
  public String addMsg() {
    boolean flag = false;
    BBSMessage bbsMessage = getBBSMessage();

    try {
      bbsMessage.setScannum(Long.parseLong("0"));
      bbsMessage.setIsessence(0);
      bbsMessageService.saveEntity(bbsMessage);
      flag = true;
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (flag) {
      return "bbs_index";
    } else {
      errmsg = "发帖失败";
      return "bbs_sent";
    }
  }
Example #5
0
  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";
  }