Author homepage: Source Space Station 2022
Introduction: High-quality creators in the Java field, Java projects, learning materials, technical mutual assistance
Get the source code at the end of the article
Project Introduction
This project includes three roles: administrator, teacher, and student;
The administrator role includes the following functions:
Administrator login, view the home page, college management, professional management, class management, user registration, release school-level notices and other functions.
The teacher role includes the following functions:
Teachers can log in, check the homepage, check and modify personal information, check topics to be approved, check status of assigned topics, check submitted topic information, message management and other functions.
A student role contains the following functions:
Students log in, view the home page, view and modify personal information, view topic selection information, view topic opening reports, view mid-term examinations, download papers, message management and other functions.
Due to the small scale of this program, it can be used for course design and graduation design learning demonstration
environmental needs
1. Operating environment: preferably java jdk 1.8, we run on this platform. Other versions are also theoretically possible.
2.IDE environment: IDEA, Eclipse,Myeclipse are all available. Recommend IDEA;
3.tomcat environment: Tomcat 7.x,8.x,9.x versions are available
4. Hardware environment: Windows 7/8/10 with 1G memory or more; or Mac OS;
5. Database: MySql 5.7 version;
6. Whether Maven project: No;
technology stack
JSP+CSS+JavaScript+servlet+mysql
Instructions for use
1. Use Navicat or other tools to create a database with the corresponding name in mysql, and import the sql file of the project;
2. Use IDEA/Eclipse/MyEclipse to import the project. When importing Eclipse/MyEclipse, if it is a maven project, please select maven;
If it is a maven project, after the import is successful, please execute the maven clean;maven install command, and then run;
3. Change the database configuration in the Connector.java configuration file in the project to your own configuration;
4. Run the project, enter http://localhost:8080/jsp_bysjsys/ in the browser to log in
Student account/password: student/123456
Instructor account/password: teacher/123456
Administrator account/password: admin/admin
run screenshot
administrator role
teacher role
student role
related code
login controller
public class LoginAction{ private static final String LOGIN = "login"; private static final String LOGOUT = "logout"; private List<Notice> alllist = null; //List of school-level notices on the home page private List<Notice> collegelist = null; //List of school-level notices on the home page private User user; private String message; private String username; //The username obtained from the login page private String password; //The password obtained from the login page public String login(){ UserDAO userDao = new UserDAO(); try { user = userDao.getUserByName(username); if (user == null) { message = "account does not exist."; return LOGIN; } else if (!user.getPassword().equals(password)) { message = "wrong password."; return LOGIN; } else { BaseUnit.put(Constants.LOGIN_USER, user); userDao.updateLoginTime(user.getUsername()); //Obtain school-level notifications and department-level notifications 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); //Log in successfully, enter the home page return "mainpage"; } } catch (SQLException e) { e.printStackTrace(); message = "system error"; 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; } }
notification controller
public class NoticeAction { private String message; private Notice notice; private String ntitle; private String ncontent; private int id; //View notification is the ID used private String scope; //Parameters used when viewing the school-level (department-level) notification list private List<Notice> notices = null; //Home Notification List 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 = "Post notification failed"; return "notexist"; } message = "Publish notification succeeded"; return "success"; } public String viewNotice(){ NoticeDAO noticeDao = new NoticeDAO(); try { notice = noticeDao.getNoticeById(id); return "success"; } catch (SQLException e) { e.printStackTrace(); message = "Failed to view notification content."; return "notexist"; } } public String moreNotice(){ NoticeDAO noticeDao = new NoticeDAO(); try { notices = noticeDao.getNoticeList(0,100,scope); } catch (SQLException e) { e.printStackTrace(); message = "system error"; 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; } }
If you also want to learn this system, get it below. Reply: 027JSP