当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
Network security -- intrusion detection of emergency response
IDEA2020中测试PySpark的运行出错
2021-07-17C#/CAD二次开发创建圆(5)
php中通过集合collect的方法来实现把某个值插入到数组中指定的位置
RMAN增量恢复示例(1)-不带未备份的归档日志
DNS攻击详解
SQLI-LABS通关(less18-less20)
sqli-labs通关汇总-page4
[leetcode question brushing day 35] 1060 Missing element in ordered array, 1901 Find the peak element, 1380 Lucky number in matrix
在php的开发环境中如何调取WebService?
Sqli labs customs clearance summary-page3
数仓模型事实表模型设计
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
Tool grass welfare post
php中计算树状结构数据中的合计
sqli-labs通关汇总-page2
pySpark构建临时表报错
How to call WebService in PHP development environment?
flex九宫格布局









