Article directory
foreword
Today, seniors share with you a java web project:
Land file management relational system based on java web
Project acquisition:
https://gitee.com/sinonfin/L-javaWebSha
1. Project design
1. Modular design
User Management Module
To use the system, a registered user needs to log in to the system.
The user management module mainly includes two parts, login and registration, which simply implement its functions, and there is no need for permission distribution.
The registration module implements the user registration function.
The login module implements the user login function.
File search module
The file search module is to search for files according to the file number.
File Adding Module
When files need to be added to the system, the detailed information of the files can be entered manually through this module to complete the file entry.
The file modification module
finds the file according to the file number, and performs the modification operation of the file information when the file information can be seen, and stores it after the modification is completed.
The file deletion module
finds the file through the file number, and then deletes the file.
2. Realize the effect
There are many functions, so I won’t show them one by one here
2. Part of the source code
Some code examples:
登录功能核心代码:
Login.java
package com.ex.web;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.ex.bean.Users;
import com.ex.common.BeanFactory;
import com.ex.common.exception.UserServiceException;
import com.ex.service.imp.UserServiceImpl;
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;
private UserServiceImpl service = (UserServiceImpl)BeanFactory.getBean("userService");
public Login() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name = request.getParameter("username");
String password = request.getParameter("password");
try {
Users users = service.login(name, password);
HttpSession session = request.getSession();
session.setAttribute("users", users);
request.getRequestDispatcher("/host.jsp").forward(request, response);
} catch (UserServiceException e) {
e.printStackTrace();
request.setAttribute("message", "<script laguage='JavaScript'> alert('用户名或密码错误,请重新输入!') </script>");
request.getRequestDispatcher("/login.jsp").forward(request, response);
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
Project source code
Project acquisition:
https://gitee.com/sinonfin/L-javaWebSha