当前位置:网站首页>JSP智能小区物业管理系统
JSP智能小区物业管理系统
2022-07-02 06:24:00 【夜未央5788】
作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目为后台管理系统,分为管理员与业主两种角色;
管理员主要功能包括:
首页、公告查询、修改密码、报修管理、业主信息、房产信息等;管理员可对业主、房产等信息进行增删改查,业主仅可查看;
业主主要功能包括:
首页、公告查询、修改密码、报修管理、业主信息、房产信息等;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;
技术栈
1. 后端:Servlet
2. 前端:JSP+CSS+JavaScript+jquery+bootstrap
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中database.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/ 登录
管理员账号/密码:admin/123456
业主账号/密码:goodym/123456
运行截图
管理员角色
业主角色界面
文档目录截图
相关代码
管理端代码控制器
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);
}
}
}
用户管理控制器
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(\"用户名或密码错误!\");" +
"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(\"用户名或密码错误!\");" +
"location.href='index.jsp';</script>");
}
}else{
response.getWriter().write("<script charset='UTF-8'>alert(\"用户名或密码错误!\");" +
"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");
}
}
}
如果也想学习本系统,下面领取。回复:120JSP
边栏推荐
- Self study table Au
- Ceaspectuss shipping company shipping artificial intelligence products, anytime, anywhere container inspection and reporting to achieve cloud yard, shipping company intelligent digital container contr
- Sqli-labs customs clearance (less15-less17)
- RMAN增量恢复示例(1)-不带未备份的归档日志
- The boss said: whoever wants to use double to define the amount of goods, just pack up and go
- 解决微信小程序swiper组件bindchange事件抖动问题
- js的防抖和节流
- Go common compilation fails
- 2021-07-19c CAD secondary development creates multiple line segments
- The table component specifies the concatenation parallel method
猜你喜欢
Sublime text configuring PHP compilation environment
Spark的原理解析
Self study table Au
Vscode installation, latex environment, parameter configuration, common problem solving
SQLI-LABS通关(less18-less20)
The table component specifies the concatenation parallel method
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
Usage of map and foreach in JS
SQL注入闭合判断
The use of regular expressions in JS
随机推荐
php中判断版本号是否连续
JS delete the last bit of the string
ORACLE 11G SYSAUX表空间满处理及move和shrink区别
sqli-labs通关汇总-page1
php中在二维数组中根据值返回对应的键值
Overload global and member new/delete
UEditor . Net version arbitrary file upload vulnerability recurrence
SQLI-LABS通关(less2-less5)
PXC high availability cluster summary
在php的开发环境中如何调取WebService?
Wechat applet Foundation
Self study table Au
Sqli-labs customs clearance (less15-less17)
DNS攻击详解
php中获取汉字拼音大写首字母
php中通过集合collect的方法来实现把某个值插入到数组中指定的位置
JS divides an array into groups of three
The table component specifies the concatenation parallel method
Anti shake and throttling of JS
php中树形结构转数组(拉平树结构,保留上下级排序)