作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目包含管理员、教师、学生三种角色;
管理员角色包含以下功能:
管理员登录,查看首页,学院管理,专业管理,班级管理,用户注册,发布校级通知等功能。
教师角色包含以下功能:
教师登录,查看首页,查看并修改个人信息,查看待审批课题,查看所带课题状态,查看已提交课题信息,消息管理等功能。
学生角色包含以下功能:
学生登录,查看首页,查看并修改个人信息,查看选题信息,查看开题报告,查看中期检查,下载论文,消息管理等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;
技术栈
JSP+CSS+JavaScript+servlet+mysql
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中Connector.java配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/jsp_bysjsys/ 登录
学生账号/密码: student/123456
指导教师账号/密码: teacher/123456
管理员账号/密码:admin/admin
运行截图
管理员角色
教师角色
学生角色
相关代码
登陆控制器
public class LoginAction{
private static final String LOGIN = "login";
private static final String LOGOUT = "logout";
private List<Notice> alllist = null; //首页校级通知列表
private List<Notice> collegelist = null; //首页院级通知列表
private User user;
private String message;
private String username; //登录页中获取的用户名
private String password; //登录页中获取的密码
public String login(){
UserDAO userDao = new UserDAO();
try {
user = userDao.getUserByName(username);
if (user == null) {
message = "帐号不存在.";
return LOGIN;
} else if (!user.getPassword().equals(password)) {
message = "密码错误.";
return LOGIN;
} else {
BaseUnit.put(Constants.LOGIN_USER, user);
userDao.updateLoginTime(user.getUsername());
//获取校级通知和院级通知
NoticeDAO noticeDao = new NoticeDAO();
alllist = noticeDao.getNoticeList(0,5,"all");
BaseUnit.put(Constants.MAINPAGE_ALL_LIST, alllist);
collegelist = noticeDao.getNoticeList(0,5,BaseUnit.getLoginUser().getCollegeid());
BaseUnit.put(Constants.MAINPAGE_COLLEGE_LIST, collegelist);
//登录成功,进入主页
return "mainpage";
}
} catch (SQLException e) {
e.printStackTrace();
message = "系统错误";
return LOGIN;
}
}
public String logout() {
BaseUnit.logout();
return LOGOUT;
}
public String notexist(){
return "notexist";
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Notice> getAlllist() {
return alllist;
}
public void setAlllist(List<Notice> alllist) {
this.alllist = alllist;
}
public List<Notice> getCollegelist() {
return collegelist;
}
public void setCollegelist(List<Notice> collegelist) {
this.collegelist = collegelist;
}
}
通知控制器
public class NoticeAction {
private String message;
private Notice notice;
private String ntitle;
private String ncontent;
private int id; //查看通知是所使用的ID
private String scope; //查看校级(院级)通知列表时使用的参数
private List<Notice> notices = null; //首页通知列表
public String submitNotice(){
User user = BaseUnit.getLoginUser();
if("sysadmin".equalsIgnoreCase(user.getRole())){
notice = new Notice(ntitle, "all", ncontent);
} else {
notice = new Notice(ntitle, user.getCollegeid(), ncontent);
}
NoticeDAO noticeDao = new NoticeDAO();
try {
noticeDao.insert(notice);
} catch (Exception e) {
e.printStackTrace();
message = "发布通知失败";
return "notexist";
}
message = "发布通知成功";
return "success";
}
public String viewNotice(){
NoticeDAO noticeDao = new NoticeDAO();
try {
notice = noticeDao.getNoticeById(id);
return "success";
} catch (SQLException e) {
e.printStackTrace();
message = "查看通知内容失败。";
return "notexist";
}
}
public String moreNotice(){
NoticeDAO noticeDao = new NoticeDAO();
try {
notices = noticeDao.getNoticeList(0,100,scope);
} catch (SQLException e) {
e.printStackTrace();
message = "系统错误";
return "notexist";
}
return "success";
}
public String notexist(){
return "notexist";
}
public Notice getNotice() {
return notice;
}
public void setNotice(Notice notice) {
this.notice = notice;
}
public String getNtitle() {
return ntitle;
}
public void setNtitle(String ntitle) {
this.ntitle = ntitle;
}
public String getNcontent() {
return ncontent;
}
public void setNcontent(String ncontent) {
this.ncontent = ncontent;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public List<Notice> getNotices() {
return notices;
}
public void setNotices(List<Notice> notices) {
this.notices = notices;
}
}
如果也想学习本系统,下面领取。回复:027JSP