基于javaweb的JSP+Servlet停车位预定管理系统(java+jsp+javascript+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

130023432402

140023432402

160023432402

170023432402

180023432402

190023432402

基于javaweb的JSP+Servlet停车位预定管理系统(java+jsp+javascript+mysql)

项目介绍

管理员角色包含以下功能: 管理员登录页面,车位信息管理,停车位信息管理,系统帮助管理,注册用户管理,留言信息管理,预定信息管理等功能。

用户角色包含以下功能: 用户首页,用户登录,查看系统通知,发表留言,预定停车位,个人信息管理,查看我的预定信息等功能。

环境需要

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版本;

技术栈

HTML+CSS+JavaScript+jsp+mysql

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/login.jsp 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48


public class user_servlet extends HttpServlet
{

public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");

if(type.endsWith("userReg"))
{
userReg(req, res);
}
if(type.endsWith("userEditMe"))
{
userEditMe(req, res);
}
if(type.endsWith("userLogout"))
{
userLogout(req, res);
}
if(type.endsWith("userMana"))
{
userMana(req, res);
}
if(type.endsWith("userDel"))
{
userDel(req, res);
}

if(type.endsWith("userSelect"))
{
userSelect(req, res);
}
}


public void userReg(HttpServletRequest req,HttpServletResponse res)
{
String id=String.valueOf(new Date().getTime());
String loginname=req.getParameter("loginname");
String loginpw=req.getParameter("loginpw");
String xingming=req.getParameter("xingming");

String zhuzhi=req.getParameter("zhuzhi");
String dianhua=req.getParameter("dianhua");
String dengji="普通会员";
String del="no";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
public void liuyanDel(HttpServletRequest req,HttpServletResponse res)
{
String sql="delete from t_liuyan where id="+Integer.parseInt(req.getParameter("id"));
Object[] params={};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("msg", "留言信息删除完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}


public void liuyanHuifu(HttpServletRequest req,HttpServletResponse res)
{
String huifu=req.getParameter("huifu");
String huifushi=new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
int id=Integer.parseInt(req.getParameter("id"));

String sql="update t_liuyan set huifu=?,huifushi=? where id=?";
Object[] params={huifu,huifushi,id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("msg", "回复完毕完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}

public void liuyanAll(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List liuyanList=new ArrayList();
String sql="select * from t_liuyan order by liuyanshi";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TLiuyan liuyan=new TLiuyan();

liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));

liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));

liuyanList.add(liuyan);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
				
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setXingming(rs.getString("xingming"));

user.setZhuzhi(rs.getString("zhuzhi"));
user.setDianhua(rs.getString("dianhua"));
user.setDengji(rs.getString("dengji"));
user.setDel(rs.getString("del"));


session.setAttribute("userType", 1);
session.setAttribute("user", user);

}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
}
if(userType==2)
{

}
return result;
}




public String userlogin(String userName,String userPw,int userType)
{
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
String result="no";

String sql="select * from t_user where loginname=? and loginpw=? and del='no'";
Object[] params={userName,userPw};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
boolean mark=(rs==null||!rs.next()?false:true);
if(mark==false)
{
result="no";
}
if(mark==true)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{

e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}

public void destroy()
{

}
}
package com.action;



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public String userlogin(String userName,String userPw,int userType)
{
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
String result="no";

String sql="select * from t_user where loginname=? and loginpw=? and del='no'";
Object[] params={userName,userPw};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
boolean mark=(rs==null||!rs.next()?false:true);
if(mark==false)
{
result="no";
}
if(mark==true)
{
result="yes";

Tuser user=new Tuser();

user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setXingming(rs.getString("xingming"));

user.setZhuzhi(rs.getString("zhuzhi"));
user.setDianhua(rs.getString("dianhua"));
user.setDengji(rs.getString("dengji"));
user.setDel(rs.getString("del"));


session.setAttribute("userType", 1);
session.setAttribute("user", user);

}
rs.close();
}
catch(Exception e)
{


项目链接:
https://javayms.github.io?id=581122512008200nn
https://javayms.pages.dev?id=581122512008200nn