当前位置:网站首页>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
边栏推荐
猜你喜欢
flex九宫格布局
PHP Session原理简析
Spark的原理解析
UEditor . Net version arbitrary file upload vulnerability recurrence
SQLI-LABS通关(less18-less20)
CSRF攻击
Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
ssm超市订单管理系统
Analysis of MapReduce and yarn principles
Ceaspectuss shipping company shipping artificial intelligence products, anytime, anywhere container inspection and reporting to achieve cloud yard, shipping company intelligent digital container contr
随机推荐
图解Kubernetes中的etcd的访问
ssm+mysql实现进销存系统
Oracle rman自动恢复脚本(生产数据向测试迁移)
[leetcode question brushing day 35] 1060 Missing element in ordered array, 1901 Find the peak element, 1380 Lucky number in matrix
MySQL index
2021-07-19c CAD secondary development creates multiple line segments
CSRF attack
php中的二维数组去重
Oracle apex Ajax process + dy verification
php中在二维数组中根据值返回对应的键值
Principle analysis of spark
js把一个数组分割成每三个一组
pm2简单使用和守护进程
CAD secondary development object
Sqli-labs customs clearance (less6-less14)
Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"
MapReduce与YARN原理解析
Overload global and member new/delete
Oracle EBS database monitoring -zabbix+zabbix-agent2+orabbix
Go package name