当前位置:网站首页>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
边栏推荐
猜你喜欢

Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool

Network security -- intrusion detection of emergency response

Ceaspectuss shipping company shipping artificial intelligence products, anytime, anywhere container inspection and reporting to achieve cloud yard, shipping company intelligent digital container contr

ORACLE EBS中消息队列fnd_msg_pub、fnd_message在PL/SQL中的应用

Sqli labs customs clearance summary-page1

CVE-2015-1635(MS15-034 )远程代码执行漏洞复现

ORACLE EBS 和 APEX 集成登录及原理分析

Redis -- cache breakdown, penetration, avalanche

Oracle EBS database monitoring -zabbix+zabbix-agent2+orabbix

Changes in foreign currency bookkeeping and revaluation general ledger balance table (Part 2)
随机推荐
js创建一个自定义json数组
ORACLE EBS DATAGUARD 搭建
Principle analysis of spark
In depth study of JVM bottom layer (V): class loading mechanism
[Zhang San learns C language] - deeply understand data storage
php中树形结构转数组(拉平树结构,保留上下级排序)
Sqli-labs customs clearance (less6-less14)
ORACLE EBS接口开发-json格式数据快捷生成
2021-07-19c CAD secondary development creates multiple line segments
Stress test modification solution
oracle EBS标准表的后缀解释说明
pm2简单使用和守护进程
oracle apex ajax process + dy 校验
Network security -- intrusion detection of emergency response
SQLI-LABS通关(less18-less20)
Tool grass welfare post
解决微信小程序swiper组件bindchange事件抖动问题
Sqli labs customs clearance summary-page4
sqli-labs通关汇总-page3
UEditor . Net version arbitrary file upload vulnerability recurrence