博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
BBS论坛系统实现-搭建Struts2+Hibernate开发环境
阅读量:4883 次
发布时间:2019-06-11

本文共 6982 字,大约阅读时间需要 23 分钟。

BBS论坛系统实现-搭建Struts2+Hibernate开发环境

1:加载Struts2框架,需要手动配置struts.xml文件。在src中建立struts.xml文件

2:要在项目中使用Struts2框架技术需要在web.xml文件中加载核心控制器FilterDispatcher.

3:hibernate.cfg.xml配置文件。

环境已经搭建好,下面就是写实体类

package entity;import java.sql.Timestamp;public class User implements java.io.Serializable {    private Integer userId;    private String userName;    private String userPassword;    private String userEmail;    private String userNickname;    private Timestamp userBirthday;    private Integer sex;    private Integer userPoints;    private String userRemark;    public User() {    }    public User(String userName, String userPassword, String userEmail,            String userNickname, Timestamp userBirthday, Integer sex,            Integer userPoints) {        this.userName = userName;        this.userPassword = userPassword;        this.userEmail = userEmail;        this.userNickname = userNickname;        this.userBirthday = userBirthday;        this.sex = sex;        this.userPoints = userPoints;    }    public User(String userName, String userPassword, String userEmail,            String userNickname, Timestamp userBirthday, Integer sex,            Integer userPoints, String userRemark) {        this.userName = userName;        this.userPassword = userPassword;        this.userEmail = userEmail;        this.userNickname = userNickname;        this.userBirthday = userBirthday;        this.sex = sex;        this.userPoints = userPoints;        this.userRemark = userRemark;    }    public Integer getUserId() {        return this.userId;    }    public void setUserId(Integer userId) {        this.userId = userId;    }    public String getUserName() {        return this.userName;    }    public void setUserName(String userName) {        this.userName = userName;    }    public String getUserPassword() {        return this.userPassword;    }    public void setUserPassword(String userPassword) {        this.userPassword = userPassword;    }    public String getUserEmail() {        return this.userEmail;    }    public void setUserEmail(String userEmail) {        this.userEmail = userEmail;    }    public String getUserNickname() {        return this.userNickname;    }    public void setUserNickname(String userNickname) {        this.userNickname = userNickname;    }    public Timestamp getUserBirthday() {        return this.userBirthday;    }    public void setUserBirthday(Timestamp userBirthday) {        this.userBirthday = userBirthday;    }    public Integer getSex() {        return this.sex;    }    public void setSex(Integer sex) {        this.sex = sex;    }    public Integer getUserPoints() {        return this.userPoints;    }    public void setUserPoints(Integer userPoints) {        this.userPoints = userPoints;    }    public String getUserRemark() {        return this.userRemark;    }    public void setUserRemark(String userRemark) {        this.userRemark = userRemark;    }}
package entity;import java.io.Serializable;import java.sql.Timestamp;public class Post implements Serializable{    private Integer postId;//帖子ID    private User user;//帖子作者    private String topic;//帖子的标题    private String matter;//帖子的内容    private Timestamp postTime;//帖子发表的日期    public Post(){}        public Post(Integer postId, User user, String topic, String matter,            Timestamp postTime) {        super();        this.postId = postId;        this.user = user;        this.topic = topic;        this.matter = matter;        this.postTime = postTime;    }    public Integer getPostId() {        return postId;    }    public void setPostId(Integer postId) {        this.postId = postId;    }    public User getUser() {        return user;    }    public void setUser(User user) {        this.user = user;    }    public String getTopic() {        return topic;    }    public void setTopic(String topic) {        this.topic = topic;    }    public String getMatter() {        return matter;    }    public void setMatter(String matter) {        this.matter = matter;    }    public Timestamp getPostTime() {        return postTime;    }    public void setPostTime(Timestamp postTime) {        this.postTime = postTime;    }                                            }
package entity;import java.sql.Timestamp;public class User implements java.io.Serializable {    private Integer userId;    private String userName;    private String userPassword;    private String userEmail;    private String userNickname;    private Timestamp userBirthday;    private Integer sex;    private Integer userPoints;    private String userRemark;    public User() {    }    public User(String userName, String userPassword, String userEmail,            String userNickname, Timestamp userBirthday, Integer sex,            Integer userPoints) {        this.userName = userName;        this.userPassword = userPassword;        this.userEmail = userEmail;        this.userNickname = userNickname;        this.userBirthday = userBirthday;        this.sex = sex;        this.userPoints = userPoints;    }    public User(String userName, String userPassword, String userEmail,            String userNickname, Timestamp userBirthday, Integer sex,            Integer userPoints, String userRemark) {        this.userName = userName;        this.userPassword = userPassword;        this.userEmail = userEmail;        this.userNickname = userNickname;        this.userBirthday = userBirthday;        this.sex = sex;        this.userPoints = userPoints;        this.userRemark = userRemark;    }    public Integer getUserId() {        return this.userId;    }    public void setUserId(Integer userId) {        this.userId = userId;    }    public String getUserName() {        return this.userName;    }    public void setUserName(String userName) {        this.userName = userName;    }    public String getUserPassword() {        return this.userPassword;    }    public void setUserPassword(String userPassword) {        this.userPassword = userPassword;    }    public String getUserEmail() {        return this.userEmail;    }    public void setUserEmail(String userEmail) {        this.userEmail = userEmail;    }    public String getUserNickname() {        return this.userNickname;    }    public void setUserNickname(String userNickname) {        this.userNickname = userNickname;    }    public Timestamp getUserBirthday() {        return this.userBirthday;    }    public void setUserBirthday(Timestamp userBirthday) {        this.userBirthday = userBirthday;    }    public Integer getSex() {        return this.sex;    }    public void setSex(Integer sex) {        this.sex = sex;    }    public Integer getUserPoints() {        return this.userPoints;    }    public void setUserPoints(Integer userPoints) {        this.userPoints = userPoints;    }    public String getUserRemark() {        return this.userRemark;    }    public void setUserRemark(String userRemark) {        this.userRemark = userRemark;    }}

 

转载于:https://www.cnblogs.com/aicpcode/p/4176297.html

你可能感兴趣的文章
unity点选构建Mesh并保存OBJ
查看>>
python kmeans实战 - 单机一层聚类(小玩具哦),下次再弄个分布式多次聚类
查看>>
Java主要有那几种文件类型?各自的作用是什么?
查看>>
我的第一个python web开发框架(29)——定制ORM(五)
查看>>
2017.11.18 手把手教你学51单片机-点亮LED
查看>>
xml的创建与解析
查看>>
grep不区分大小写查找字符串方法
查看>>
linux系统灵活运用灯[android课程3]
查看>>
Android 通用Dialog中设置RecyclerView
查看>>
利用 Android Studio 和 Gradle 打包多版本APK
查看>>
Android 自定义标题栏
查看>>
Android 如何把一个 RelativeLayout或ImageView背景设为透明
查看>>
tomcat优化方向
查看>>
http
查看>>
8-1-组队赛
查看>>
codility: CountTriangles
查看>>
赛斯说
查看>>
python 中的pipe
查看>>
(SQL Analyzer services)定义链接维度
查看>>
squid
查看>>