「java私信评论」java私信功能

博主:adminadmin 2022-12-08 17:15:05 103

本篇文章给大家谈谈java私信评论,以及java私信功能对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

java/jsp 帖子评论的回复功能如何实现

在回复按钮或者HREF上通过action将发帖人的id和帖子id传出去,获取到id来判断本次回复是针对那个人发的哪一个帖子的。

java web 评论及回复系统

评论肯定是基于文章的,文章肯定有唯一的ID。

这样的话,可以让评论全部关联到这个ID上。

随便写写,代码不能运行,参考即可。

public class Comment {

    Long id;

    Article article;//文章

    User user;//用户

    Date date;//时间

    String content;//内容

}

public class CommentService {

    void addComment(Article article, User user, String content);

    void updateComment(Comment comment);

    void deleteComment(Comment commnet);

    ListComment findCommentByArticle(Article article);

    ListComment findCommentByUser(User user);

}

public class AddCommentAction {

    private Long articleId;

    private Long userId;

    private String content;

    

    public String execute() {

        Article article = articleService.getArticle(articleId);

        User user = userService.getUser(userId);

        commentService.addComment(article, user, comment);

        return SUCCESS;

    }

}

java评论和回复 回复的人可以回复回复评论文章的人 这样的表如何设计好呢

table:主题表

col: id,content

table:评论表

col:评论id,主题id,ref_评论id

评论表的ref_评论id关联到评论表的评论id 相当于父子结构

数据量小的时候可以这么设计。

java私信评论的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java私信功能、java私信评论的信息别忘了在本站进行查找喔。

The End

发布于:2022-12-08,除非注明,否则均为首码项目网原创文章,转载请注明出处。