The classroom reservation reservation system written in Java web can be run after downloading the complete source code

   Today I would like to share with you a good and excellent code. At present, the system functions are very comprehensive and will be further improved in the future. The interface of the whole system is beautiful, with complete source code, I hope everyone can like it. Help like and follow. Program together and progress together.

development environment

The development language is Java, and the development environment is Eclipse or IDEA. Database used: MySQL.

This project is a Web application development based on MVC's JSP technology, in which

  • JSP technology is the presentation layer, including EL expression, JSP action, JSTL standard tag technology
  • Servlet is the control layer technology
  • JavaBean is the development model layer
  • Use the MVC design pattern to develop each module
  • The database uses mysql database
  • Using Tomcat as a Web server
  • Firefox browser, 360 browser, Chrome browser, IE browser as the running browser of this program

Main functions of the system

1 user login

  The user enters the user and password. If the user name and password are correct, it will prompt that the login is successful, and adjust to the main interface; otherwise, it will prompt that the user name or password is wrong, and jump to the login interface.

2 classroom reservations

  Select the appointment date, select the start time and deadline, and click Submit. The system will check whether there is a relevant order in the system. If the number of reservations exceeds the number, it will prompt that the reservation has failed, otherwise a corresponding reservation order will be generated.

3 View Appointments

  Check out your reservations. Reservation order includes order number, personnel, start time, deadline, etc.

4 Classroom Management

   This function is available to the system administrator. The system administrator can perform daily maintenance on classrooms in the system, including operations such as adding, deleting, and modifying classrooms. Classroom information includes: (classroom name, floor, capacity, development time, end time, whether there is projection equipment, whether there is video equipment)

5 User Management

   This function is provided by the system administrator. The system administrator can perform daily maintenance on users in the system, including operations such as adding, deleting, and modifying users. User information includes: (username, password, email)

6 Modify user information

   After the user logs in, he can perform self-service maintenance on the user's user name and password and other information. After the system is modified, it will take effect immediately

running result

1 user login

2 user registration

3 User Management

4 Classroom Management

 4 Make an appointment to view the order

 5 Classroom Reservation Status Inquiry

 6 Personal Information Maintenance

key code

public void userLogin(HttpServletRequest req, HttpServletResponse res) {
		User user=null;
		String result = "no";
		String loginName = req.getParameter("loginName");
		String loginPw = req.getParameter("loginPw");
		String userType = req.getParameter("userType");
		String sql = "select * from t_user where userAuthority=? and userName=? and userPassword=?";
		Object[] params = { userType, loginName, loginPw };
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			boolean mark = (rs == null || !rs.next() ? false : true);
			if (mark == false) {
				result = "no";
			}
			if (mark == true) {
				 user = new User();
				user.setUserAuthority(rs.getString("userAuthority"));
				user.setUserId(rs.getString("userId"));
				user.setUserMail(rs.getString("userMail"));
				user.setUserName(rs.getString("userName"));
				user.setUserPassword(rs.getString("userPassword"));
				System.out.println(" type is:" + rs.getString("userAuthority"));
				result = "yes";
				req.getSession().setAttribute("user", user);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		if (result.equalsIgnoreCase("yes")) {
			System.out.println("mybookcnt:"+ConflictDect.getBookCnt(user.getUserId()));
			req.setAttribute("bookcnt",ConflictDect.getBookCnt(user.getUserId()));
			String targetURL = "/common/success2.jsp";
			dispatch(targetURL, req, res);
		} else {
			req.setAttribute("message", "用户名或者密码错");
			req.setAttribute("path", "/bookclassroom/admin/login.jsp");
			String targetURL = "/common/success.jsp";
			dispatch(targetURL, req, res);
		}
	}

project summary

(1) Before writing the code, the thinking must be clear in the brain, not vague, must draw the function diagram and flow chart, and then implement each function block according to it, analyze more, and cultivate a good logical thinking ability.

(2) In the process of writing code, the principle of proximity must be adopted. Generally, the same function or the settings for the same component should be written together, so that the program written in this way is clearer, less prone to errors, and easier to find.

(3) To develop good commenting habits, first, it is beneficial for others to read your program, and it is also beneficial for yourself to read it later, so that you can quickly understand the program and improve efficiency.

(4) Modularize the function, that is, encapsulate the code segment that implements the same function into a class or a method, and call it when it is implemented, which can improve the readability of the code

(5) Create packages to store classes with different functions to make the system structure more modular and standardized.

(6) When writing code, you must debug while writing, set breakpoints in a timely manner, or output the value of some variables to the console, and observe and analyze the value of variables to facilitate the judgment of the problem.

Guess you like

Origin blog.csdn.net/bangxiecode/article/details/131385645