GayHub:无名的基于JSP和Servlet的论坛模板
建议自己建工程,然后把文件复制进去 不建议直接导入 出于安全性考虑 所有可能泄露个人隐私(如我的用户目录路径、数据库密码等)的相关配置已被删除 可能会导致许多问题
CentOS 7修改MySQL默认编码 顺便记一下MySQL 5.0版本以上VARCHAR(50)就是可以放50个汉字
出于安全性考虑 设置一个新用户UserName只能在localhost上登录
create user 'UserName'@'localhost' identified by 'password'; grant select,insert,update,delete on wumingBBS.* to UserName@localhost;用户信息表(邮箱,用户名_主键,密码,账号状态)
create table emailuserpass( emailAddress varchar(40) not null, userName varchar(40) primary key not null, password varchar(40) not null, Available boolean not null )engine=innodb default charset=utf8 collate=utf8_general_ci;管理员信息表(邮箱,管理员名_主键,密码)
create table admin( emailAddress varchar(40) not null, adminName varchar(40) primary key not null, password varchar(40) not null )engine=innodb default charset=utf8 collate=utf8_general_ci;帖子表(贴id_主键_自增,用户名_外键,贴信息,发帖时间)
create table post( postID int(4) primary key auto_increment, userName varchar(40) not null, postInfo varchar(200) not null, postDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, foreign key (userName) references emailuserpass(userName) on delete cascade )engine=innodb default charset=utf8 collate=utf8_general_ci;评论表
create table postcomment( commentID int(4) primary key auto_increment, postID int(4), userName varchar(40) not null, commentInfo varchar(200) not null, commentDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, foreign key (postID) references post(postID) on delete cascade on update cascade, foreign key (userName) references emailuserpass(userName) on delete cascade )engine=innodb default charset=utf8 collate=utf8_general_ci;ER图
对外提供数据库连接池接口的包 其下ConnectionPool主要方法有:提供连接池实例、提供连接实例、释放连接
myfilter过滤器包 其下三个Filter分别对AdminShowAll.jsp、AdminView.jsp、UserView.jsp进行访问控制 防止越权查看信息
myjavabeanjavabean包 其下四个bean分别对应数据库中四张表
myservlet其下五个Servlet分别用于处理 管理员登录及删封、对某条帖子的评论、用户发帖、游客查看帖子、用户注册及登录 的相关请求
mysql数据访问层(注意:由于欠考虑所以我这层分的不是很清楚) 实际应该再细分一层 其下的Java代码分别用于对外提供 管理员登录 评论增删查 帖子增删查 用户注册 登录 封禁 查看 的相关方法
