Ejemplo n.º 1
0
  public Memo readMemo(HttpServletRequest request) {
    String memo_num_str = request.getParameter("memo_num");
    int memo_num = Integer.parseInt(memo_num_str);
    Memo result = null;
    Memo result_tmp = null;

    if (dao.updateReadCount(memo_num) > 0) {
      result = dao.selectMemo(memo_num);

      result_tmp = dao.selectUpdown(memo_num);

      if (result_tmp == null) {
        result_tmp = new Memo();
      }

      result.setUp(result_tmp.getUp());
      result.setDown(result_tmp.getDown());

      result_tmp = dao.selectRep(memo_num);

      if (result_tmp == null) {
        result_tmp = new Memo();
      }

      result.setReply(result_tmp.getReply());
    }

    return result;
  }
Ejemplo n.º 2
0
  public int write(HttpServletRequest request) {
    String id = request.getParameter("id");
    String content = null;
    String sido = null;
    String sigugun = null;

    System.out.println("하기 전 : " + request.getParameter("sido"));
    try {
      System.out.println("하고난 후 : " + URLDecoder.decode(request.getParameter("sido"), "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }

    try {
      content = URLDecoder.decode(request.getParameter("content"), "UTF-8");
      sido = URLDecoder.decode(request.getParameter("sido"), "UTF-8");
      sigugun = URLDecoder.decode(request.getParameter("sigugun"), "UTF-8");
    } catch (UnsupportedEncodingException e1) {
      e1.printStackTrace();
    }
    String posvalue = request.getParameter("posvalue");

    Memo memo = new Memo();
    memo.setId(id);
    memo.setContent(content);
    memo.setSido(sido);
    memo.setSigugun(sigugun);
    memo.setPosvalue(posvalue);

    int result = 0;
    result = dao.insertMemo(memo);

    return result;
  }