基于javaweb的JSP+Servlet网上订餐管理系统(java+jsp+bootstrap+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

150023402402

160023402402

170023402402

180023402402

200023402402

210023402402

基于javaweb的JSP+Servlet网上订餐管理系统(java+jsp+bootstrap+jquery+mysql)

项目介绍

基于JSP+Servlet的网上订餐管理系统的设计与实现。该项目为前后台管理项目。 前台主要展示给普通用户,主要功能有菜品分类、最新菜品、销售排行、美食预订、营养小贴士、餐点搜索、订餐车、 在线留言等;

后台主要提供给管理员,主要功能有菜品管理、菜品类别管理、营养小贴士管理、会员管理、员工管理、留言管理、采购管理、销售订单查询、统计管理、用户管理等;

环境需要

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.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目  6.数据库:MySql 5.7版本;

技术栈

  1. 后端:Servlet 2. 前端:JSP+bootstrap+jQuery

使用说明

  1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包; 2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中DBConn.java文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录 5. 后台管理员账户:admin 密码:admin 前台普通用户:111 密码:111

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
	public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Validate vd = new Validate();
String name = vd.getUnicode(request.getParameter("name"));
String pwd = vd.getUnicode(request.getParameter("pwd"));
String zname = vd.getUnicode(request.getParameter("zname"));
String sex = vd.getUnicode(request.getParameter("sex"));
String age = vd.getUnicode(request.getParameter("age"));
String noid = vd.getUnicode(request.getParameter("noid"));
String address = vd.getUnicode(request.getParameter("address"));
String phone = vd.getUnicode(request.getParameter("phone"));
String email = vd.getUnicode(request.getParameter("email"));
String code = vd.getUnicode(request.getParameter("code"));
String sql = "insert into users(name,pwd,realname,sex,age,card,address,phone,email,code) values('"+name+"','"+pwd+"','"+zname+"','"+sex+"','"+age+"','"+noid+"','"+address+"','"+phone+"','"+email+"','"+code+"')";
InsertUpdateDelBean ib = new InsertUpdateDelBean();
int flag = ib.insertANDupdateANDdel(sql);
if(flag == -1){
request.setAttribute("error", "1");
}else{
request.setAttribute("ok", "1");
response.setHeader("Refresh","5;URL=../qiantai/index.jsp");
}
RequestDispatcher rd=request.getRequestDispatcher("/qiantai/reg.jsp");
rd.forward(request,response);
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}

}
package com.demo.servlet.admin;



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
        else
{
m_response.setContentType(s1);
}
}
m_response.setContentLength((int)l);
m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
if(s2 == null)
{
m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
}
else
{
if(s2.length() == 0)
{
m_response.setHeader("Content-Disposition",m_contentDisposition);
}
else
{
m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + s2);
}
}
while((long)k < l)
{
int j = fileinputstream.read(abyte0,0,i);
k += j;
m_response.getOutputStream().write(abyte0,0,j);
}
fileinputstream.close();
}

public void downloadField(ResultSet resultset,String s,String s1,String s2) throws ServletException,IOException,SQLException
{
if(resultset == null)
{
throw new IllegalArgumentException("The RecordSet cannot be null (1045).");
}
if(s == null)
{
throw new IllegalArgumentException("The columnName cannot be null (1050).");
}
if(s.length() == 0)
{
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


public class ListServlet extends HttpServlet {

/**
* Constructor of the object.
*/
public ListServlet() {
super();
}

/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {


SelectBean ib = new SelectBean();

String sql1 = "select * from types";
String[] args1 = {"id","name"};
ArrayList al1 = ib.select(sql1, args1);
request.setAttribute("type", al1);

String sql2 = "select * from books";
String[] args2 = {"id","name","author","publishing","number","price","storage","brief","type","tate","sums","imgpath","price1","sums1"};
ArrayList al2 = ib.select(sql2, args2);
request.setAttribute("books", al2);

String sql3 = "select * from books order by sums1 desc";
String[] args3 = {"id","name","author","publishing","number","price","storage","brief","type","tate","sums","imgpath","price1","sums1"};
ArrayList al3 = ib.select(sql3, args3);
request.setAttribute("xiaosou", al3);

String sql5 = "select * from books where tate=1";
String[] args5 = {"id","name","author","publishing","number","price","storage","brief","type","tate","sums","imgpath","price1","sums1"};
ArrayList al5 = ib.select(sql5, args5);
request.setAttribute("tuibook", al5);

String sql6 = "select * from books where tate=2";
String[] args6 = {"id","name","author","publishing","number","price","storage","brief","type","tate","sums","imgpath","price1","sums1"};
ArrayList al6 = ib.select(sql6, args6);
request.setAttribute("newbook", al6);

String sql7 = "select * from users";
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
			request.setAttribute("bookId", bookid);
}else{
sql = "select * from loanbook where users='"+login.get(0)+"' and books='"+bookid+"' and flag='未点菜'";
String[] args = {"id","users","books","price","sumday","begintime","endtime","continueday","continuetime","flag"};
ArrayList al = sb.select(args, sql);
if(al != null && al.size() != 0){
str = "/qiantai/loan_book.jsp";
request.setAttribute("error2", "1");
request.setAttribute("bookId", bookid);
}else{
sql = "insert into loanbook(users,books,price,sumday) values('"+login.get(0)+"','"+bookid+"','"+price+"','"+sumday+"')";
ib.insertANDupdateANDdel(sql);
sql = "select max(id) as id from loanbook";
String[] args1 = {"id"};
ArrayList al1 = sb.select(args1, sql);
sql = "update loanbook set endtime=dateadd(day,"+sumday+",begintime) where id="+al1.get(0);
ib.insertANDupdateANDdel(sql);
sql = "update books set sums=sums+1 where id="+bookid;
ib.insertANDupdateANDdel(sql);
str = "/qiantai/loan_book_note.jsp";
request.setAttribute("ok", "1");
}
}
RequestDispatcher rd=request.getRequestDispatcher(str);
rd.forward(request,response);
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}

}
package com.demo.servlet.admin;


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
    {
m_allowedFilesList = null;
}
}

public void setDenyPhysicalPath(boolean flag)
{
m_denyPhysicalPath = flag;
}

public void setForcePhysicalPath(boolean flag)
{
//m_forcePhysicalPath = flag;
}

public void setContentDisposition(String s)
{
m_contentDisposition = s;
}

public void setTotalMaxFileSize(long l)
{
m_totalMaxFileSize = l;
}

public void setMaxFileSize(long l)
{
m_maxFileSize = l;
}

protected String getPhysicalPath(String s,int i) throws IOException
{
String s1 = ""; //new String();
String s2 = ""; //new String();
String s3 = ""; //new String();
boolean flag = false;
s3 = System.getProperty("file.separator");
if(s == null)
{
throw new IllegalArgumentException("There is no specified destination file (1140).");
}
if(s.equals(""))
{
throw new IllegalArgumentException("There is no specified destination file (1140).");
}
if(s.lastIndexOf("\\") >= 0)
{
s1 = s.substring(0,s.lastIndexOf("\\"));
s2 = s.substring(s.lastIndexOf("\\") + 1);
}


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