项目debug1

QuestionController代码如下:

@RequestMapping(value = "/question/{qid}", method = {RequestMethod.GET})
    public String questionDetail(Model model, @PathVariable("qid") int qid) {
        Question question = questionService.getById(qid);
        model.addAttribute("question", question);

        List<Comment> commentList = commentService.getCommentsByEntity(qid, EntityType.ENTITY_QUESTION);
        List<ViewObject> comments = new ArrayList<ViewObject>();
        for (Comment comment : commentList) {
            ViewObject vo = new ViewObject();
            vo.set("comment", comment);
            if (hostHolder.getUser() == null) {
                vo.set("liked", 0);
            } else {
                vo.set("liked", likeService.getLikeStatus(hostHolder.getUser().getId(), EntityType.ENTITY_COMMENT, comment.getId()));
            }
            vo.set("likeCount", likeService.getLikeCount(EntityType.ENTITY_COMMENT, comment.getId()));
            vo.set("user", userService.getUser(comment.getUserId()));
            comments.add(vo);
        }
        model.addAttribute("comments", comments);
        return "detail";
    }

  detail.html是没有问题的,访问:

到底是什么问题呢?----待解决。

 安装:

最后,进入cmd窗口:

将所有类的main方法都去掉,然后,执行这个,运行结果如下:

 

 再次,登录,点击问题,最后,成功显示问题界面。

现在又冒出另外一个问题,给评论点赞,点赞无效。debug测试,压根没有进入LikeController,所以,应该是前端的问题。

因此,如何区分是前端的问题还是后台的问题呢?

 

posted @ 2017-05-09 14:56  知我者,足以  阅读(478)  评论(0编辑  收藏  举报