基于javaweb+mysql的网上订餐在线点餐管理系统(前台、后台)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
1.前台模块:
(1)食品展示模块
(2)食品查询模块
(3)购物车模块
(4)收银台模块
(5)用户维护模块
(6)订单查询模块
(7)公告模块
2.后台模块:
(1)食品管理模块
(2)用户管理模块
(3)管理员维护模块
(4)订单管理模块
(5)公告管理模块
(6)留言管理模块
eclipse或MyEclipse或idea
普通用户(前台)
管理员(后台)
技术框架
CSS JavaScript JSP Servlet JDBC MySQL
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
String beforehand = vd.getUnicode(request.getParameter("beforehand"));
String nutrition = vd.getUnicode(request.getParameter("nutrition"));
String stock = vd.getUnicode(request.getParameter("stock"));
String emp = vd.getUnicode(request.getParameter("emp"));
InsertUpdateDelBean ib = new InsertUpdateDelBean();
String sql = "";
String str = "";
if(bookid != null && !bookid.equals("")){
str = "/admin/booklist.jsp";
sql = "delete from books where id='"+bookid+"'";
ib.insertANDupdateANDdel(sql);
}
if(typeid != null && !typeid.equals("")){
str = "/admin/typelist.jsp";
sql = "delete from types where id='"+typeid+"'";
int flag = ib.insertANDupdateANDdel(sql);
if(flag == -1){
request.setAttribute("error", "1");
}
}
if(userid != null && !userid.equals("")){
str = "/admin/userlist.jsp";
sql = "delete from users where id='"+userid+"'";
ib.insertANDupdateANDdel(sql);
int j = i + s2.length();
int k = j;
s2 = "\"";
int l = s.indexOf(s2,j);
if(k > 0 && l > 0)
{
s3 = s.substring(k,l);
}
}
return s3;
}
private String getFileExt(String s)
{
String s1; // = new String();
int i = 0;
int j = 0;
String type = "";
String path = "";
String str = "";
SmartUpload mySmartUpload = new SmartUpload();//init
mySmartUpload.initialize(config,request,response);
try {
mySmartUpload.upload();
name = mySmartUpload.getRequest().getParameter("name").trim();
author = mySmartUpload.getRequest().getParameter("author").trim();
price1 = mySmartUpload.getRequest().getParameter("price1").trim();
brief = mySmartUpload.getRequest().getParameter("brief").trim();
type = mySmartUpload.getRequest().getParameter("type").trim();
int count = 0;
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt = file.getFileExt();
path="/bookimg";
InsertUpdateDelBean ib = new InsertUpdateDelBean();
String sql = "insert into books(name,author,brief,type,imgpath,price1)" +
" values('"+name+"','"+author+"','"+brief+"','"+type+"','"+path.substring(1)+"/"+file.getFileName()+"','"+price1+"')";
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<base href="<%=basePath%>">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script language="JavaScript" src="img/date.js"></script>
</head>
<style>
<!--
*{padding:0;margin:0}
.ry{background:#FFF8F0}
String s8 = ""; //new String();
String s9 = ""; //new String();
String s10 = ""; //new String();
m_totalBytes = m_request.getContentLength();
m_binArray = new byte[m_totalBytes];
int j;
for(;i < m_totalBytes;i += j)
{
try
{
m_request.getInputStream();
j = m_request.getInputStream().read(m_binArray,i,m_totalBytes - i);
}
catch(Exception exception)
{
throw new SmartUploadException("Unable to upload.");
}
}
for(;!flag1 && m_currentIndex < m_totalBytes;m_currentIndex++)
{
if(m_binArray[m_currentIndex] == 13)
{
flag1 = true;
}
else
alShop.add(""+sum);
shopping.add(alShop);
}
}
}
if(del != null && !del.equals("") && shopping !=null && shopping.size()!= 0){
shopping.remove(Integer.parseInt(del));//删除商品
}
session.setAttribute("shopping",shopping);
if(remove != null && !remove.equals("") && session.getAttribute("shopping") != null && !session.getAttribute("shopping").equals("")){
session.removeAttribute("shopping");//清空购物车
}
}
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>
*
</script>
<jsp:include flush="true" page="/servlet/SessLoginServlet"/>
<body>
<form action="servlet/ModifyUserServlet" name="form1" method="post" onSubmit="return check11()">
<jsp:include flush="true" page="top.jsp"/>
<div align="center"><br>
private String getDataFieldValue(String s,String s1)
{
String s2 = ""; // = new String();
String s3 = ""; // = new String();
int i = 0;
//boolean flag = false;
//boolean flag1 = false;
//boolean flag2 = false;
s2 = s1 + "=" + '"';
i = s.indexOf(s2);
if(i > 0)
{
int j = i + s2.length();
int k = j;
s2 = "\"";
int l = s.indexOf(s2,j);
if(k > 0 && l > 0)
file.setFileExt(s5);
file.setFilePathName(s6);
file.setIsMissing(s6.length() == 0);
file.setContentType(s7);
file.setContentDisp(s8);
file.setTypeMIME(s9);
file.setSubTypeMIME(s10);
if(s7.indexOf("application/x-macbinary") > 0)
{
m_startData = m_startData + 128;
}
file.setSize((m_endData - m_startData) + 1);
file.setStartData(m_startData);
file.setEndData(m_endData);
m_files.addFile(file);
}
else
{
String s11 = new String(m_binArray,m_startData,(m_endData - m_startData) + 1);
j++;
}
}
return j;
}
//Add
private String[] FileNames;
public String[] getFileNames()
{
//Method may expose internal representation by returning array
//Returning an array value stored in one of the object's fields exposes the internal representation of the object.? For classes shared by other untrusted classes, this could potentially be a security issue.? Returning a new copy of the array is better approach in many situations.
String[] vFileNames = new String[FileNames.length];
System.arraycopy(FileNames,0,vFileNames,0,FileNames.length);
return vFileNames;
}
public int getSize()
{
return m_totalBytes;
}
public byte getBinaryData(int i)
{
byte byte0;
try