protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");

    HttpSession session = request.getSession();
    UserInfo user = (UserInfo) session.getAttribute("userinfo");

    int uid = user.getU_id();
    BlogDao bDao = new BlogDao();
    // set number of blogs per page
    int showPageNum = 4; // 每页个数
    int currPage = 1;
    if (request.getParameter("p") != null) currPage = Integer.parseInt(request.getParameter("p"));

    ArrayList<Blog> CollectBlogList = bDao.getCollectBlog(uid, showPageNum, currPage);
    long counts = bDao.getAllCollectBlogSum(uid);
    int totalPages = (int) counts / showPageNum + ((counts % showPageNum) > 0 ? 1 : 0);

    // get comments
    CommentDao cDao = new CommentDao();
    for (Blog b : CollectBlogList) {
      ArrayList<Comment> CommentList = cDao.getAllCommentsByBid(b.getBid());
      b.setCommentList(CommentList);
      b.setContentLink();
      for (Comment c : CommentList) {
        c.setContentLink();
      }
    }

    // put into DataMap
    Map<String, Object> root = new HashMap<>();
    root.put("account", user.getU_account());
    root.put("p", currPage);
    root.put("totalPages", totalPages);
    root.put("CollectBlogList", CollectBlogList);

    Template template = cfg.getTemplate("CollectBlog.ftl");
    Writer out = response.getWriter();
    try {
      template.process(root, out);
    } catch (TemplateException e) {
      WeiboLogger.exception(e);
    }
  }