当前位置:网站首页>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 EBS database monitoring -zabbix+zabbix-agent2+orabbix
- 工具种草福利帖
- ORACLE 11.2.0.3 不停机处理SYSAUX表空间一直增长问题
- Data warehouse model fact table model design
- SQLI-LABS通关(less18-less20)
- ORACLE 11G SYSAUX表空间满处理及move和shrink区别
- Stress test modification solution
- JS judge whether the object is empty
- mapreduce概念和案例(尚硅谷学习笔记)
- php中计算树状结构数据中的合计
猜你喜欢

Sqli-labs customs clearance (less6-less14)

Sqli-labs customs clearance (less1)
![[Zhang San learns C language] - deeply understand data storage](/img/b5/cf0bfae8eacf335d3c350c9cbadb87.png)
[Zhang San learns C language] - deeply understand data storage

IDEA2020中PySpark的两表关联(字段名相同)

Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"

Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence

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

MapReduce concepts and cases (Shang Silicon Valley Learning Notes)

Sqli Labs clearance summary - page 2

Ingress Controller 0.47.0的Yaml文件
随机推荐
ORACLE EBS DATAGUARD 搭建
Sqli - Labs Clearance (less6 - less14)
ssm+mysql实现进销存系统
SQL injection closure judgment
Pyspark build temporary report error
Overload global and member new/delete
Flex Jiugongge layout
php中生成随机的6位邀请码
MySQL index
ORACLE 11G SYSAUX表空间满处理及move和shrink区别
js创建一个自定义json数组
JSP智能小区物业管理系统
js数组的常用的原型方法
Review of reflection topics
在php的开发环境中如何调取WebService?
Stress test modification solution
js删除字符串的最后一位
SQLI-LABS通关(less18-less20)
RMAN增量恢复示例(1)-不带未备份的归档日志
Underlying mechanism mvcc