当前位置:网站首页>JSP intelligent community property management system
JSP intelligent community property management system
2022-07-02 07:11:00 【Night Weiyang 5788】
Author URI : In the middle of the night 5788
brief introduction :Java Quality creators in the field 、Java project 、 Learning materials 、 Technical assistance
Get the source code at the end of the article
Project introduction
This project is a background management system , There are two roles: administrator and owner ;
The main functions of the administrator include :
home page 、 Announcement query 、 Change Password 、 Repair management 、 Owner information 、 Real estate information, etc ; The administrator can report to the owner 、 Add, delete, modify and check real estate and other information , Owner can only view ;
The main functions of the owner include :
home page 、 Announcement query 、 Change Password 、 Repair management 、 Owner information 、 Real estate information, etc ;
Environmental needs
1. Running environment : It is best to java jdk 1.8, We run on this platform . Other versions can, in theory .
2.IDE Environmental Science :IDEA,Eclipse,Myeclipse Fine . recommend IDEA;
3.tomcat Environmental Science :Tomcat 7.x,8.x,9.x All versions are available
4. Hardware environment :windows 7/8/10 1G Above memory ; perhaps Mac OS;
5. database :MySql 5.7 edition ;
6. whether Maven project : no ;
Technology stack
1. Back end :Servlet
2. front end :JSP+CSS+JavaScript+jquery+bootstrap
Instructions
1. Use Navicat Or other tools , stay mysql Create a database with the corresponding name in , And import the sql file ;
2. Use IDEA/Eclipse/MyEclipse Import the project ,Eclipse/MyEclipse Import time , if maven Item, please select maven;
if maven project , After importing successfully, please execute maven clean;maven install command , And then run ;
3. In the project database.properties Change the database configuration in the configuration file to your own configuration ;
4. Run the project , Input http://localhost:8080/ Sign in
Administrator account / password :admin/123456
Owner's account number / password :goodym/123456
Run a screenshot
Administrator role
Owner role interface
Screenshot of document directory
Related codes
Management side code controller
public class AdminServlet extends HttpServlet{
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=UTF-8;");
String action = request.getParameter("action");
IAdminService adminService = new AdminServiceImpl();
if("adminList".equals(action)){
List<Admin> list = adminService.findAlladmins();
request.setAttribute("admins", list);
RequestDispatcher rd = request.getRequestDispatcher("admin/admin-list.jsp");
rd.forward(request, response);
}else if("adminAdd".equals(action)){
String name = request.getParameter("name");
String password = MD5Util.encode(request.getParameter("password"));
String sex = request.getParameter("sex");
String age = request.getParameter("age");
String tel = request.getParameter("tel");
String phone = request.getParameter("phone");
String addr = request.getParameter("addr");
String memo = request.getParameter("memo");
System.out.println(name+password+tel+phone+addr+memo);
Number ag = Integer.parseInt(age);
Admin a = new Admin();
a.setName(name);
a.setPassword(password);
a.setSex(sex);
a.setAge(ag);
a.setTel(tel);
a.setPhone(phone);
a.setAddr(addr);
a.setMemo(memo);
adminService.save(a);
response.sendRedirect("admin?action=adminList");
}else if("findById".equals(action)){
String id = request.getParameter("id");
Admin a = adminService.findById(id);
request.setAttribute("admin", a);
RequestDispatcher rd = request.getRequestDispatcher("admin/admin-edit.jsp");
rd.forward(request, response);
}else if("adminEdit".equals(action)){
int id = Integer.parseInt(request.getParameter("id"));
String name = request.getParameter("name");
String password = MD5Util.encode(request.getParameter("password"));
String sex = request.getParameter("sex");
String age = request.getParameter("age");
String tel = request.getParameter("tel");
String phone = request.getParameter("phone");
String addr = request.getParameter("addr");
String memo = request.getParameter("memo");
int ag = Integer.parseInt(age);
Admin a = new Admin();
a.setId(id);
a.setName(name);
a.setPassword(password);
a.setSex(sex);
a.setAge(ag);
a.setTel(tel);
a.setPhone(phone);
a.setAddr(addr);
a.setMemo(memo);
adminService.update(a);
response.sendRedirect("admin?action=adminList");
}else if("adminDelete".equals(action)){
String id = request.getParameter("id");
adminService.delete(id);
response.sendRedirect("admin?action=adminList");
}
else if("change".equals(action)){
String id = request.getParameter("id");
Admin a = adminService.findById(id);
request.setAttribute("admin", a);
RequestDispatcher rd = request.getRequestDispatcher("admin/adminChange.jsp");
rd.forward(request, response);
}
}
}
User management controller
public class UserServlet extends HttpServlet{
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
String action = request.getParameter("action");
IAdminService as = new AdminServiceImpl();
ICustomAccountService cs = new CustomAccountServiceImpl();
HttpSession session = request.getSession();
if("login".equals(action)){
String name = request.getParameter("username");
String password = MD5Util.encode(request.getParameter("password"));
String usertype = request.getParameter("usertype");
Admin a = as.findBynp(name, password);
CustomAccount c = cs.findBynp(name, password);
if(a != null){
String n = a.getName();
String p = a.getPassword();
if(n.equals(name) && p.equals(password)&&"admin".equals(usertype)){
session.setAttribute("admin", a);
response.sendRedirect("index.jsp");
}else{
response.getWriter().write("<script charset='UTF-8'>alert(\" Wrong user name or password !\");" +
"location.href='index.jsp';</script>");
}
}else if(c != null){
String n = c.getUsername();
String p = c.getPassword();
if(n.equals(name) && p.equals(password)&&"user".equals(usertype)){
session.setAttribute("customAccount", c);
response.sendRedirect("index2.jsp");
}else{
response.getWriter().write("<script charset='UTF-8'>alert(\" Wrong user name or password !\");" +
"location.href='index.jsp';</script>");
}
}else{
response.getWriter().write("<script charset='UTF-8'>alert(\" Wrong user name or password !\");" +
"location.href='index.jsp';</script>");
}
}else if("logout".equals(action)){
session.invalidate();
//if (request.getSession(false)==null) System.out.println(123);
response.sendRedirect("login.jsp");
}else if("relogin".equals(action)){
session.invalidate();
response.sendRedirect("login.jsp");
}
}
}
If you want to learn this system , Now get . reply :120JSP
边栏推荐
- ORACLE APEX 21.2安装及一键部署
- Cve - 2015 - 1635 (ms15 - 034) réplication de la vulnérabilité d'exécution de code à distance
- CRP实施方法论
- php中的二维数组去重
- Network security -- intrusion detection of emergency response
- Date time API details
- In depth study of JVM bottom layer (II): hotspot virtual machine object
- JS divides an array into groups of three
- php中计算树状结构数据中的合计
- CSRF攻击
猜你喜欢
随机推荐
Brief analysis of PHP session principle
RMAN incremental recovery example (1) - without unbacked archive logs
SQLI-LABS通关(less6-less14)
js把一个数组分割成每三个一组
MapReduce与YARN原理解析
Underlying mechanism mvcc
Yolov5 practice: teach object detection by hand
SQLI-LABS通關(less6-less14)
Sqli-labs customs clearance (less15-less17)
ORACLE EBS DATAGUARD 搭建
Sqli - Labs Clearance (less6 - less14)
Build FRP for intranet penetration
数仓模型事实表模型设计
php中根据数字月份返回月份的英文缩写
Atcoder beginer contest 253 F - operations on a matrix / / tree array
Sentry construction and use
Basic knowledge of software testing
Tool grass welfare post
php中的二维数组去重
SQLI-LABS通关(less18-less20)