基于javaweb+mysql的jsp+servlet网上订餐在线点餐管理系统(前台、后台)(java+jsp+servlet+jdbc+mysql+tomcat)

基于javaweb+mysql的jsp+servlet网上订餐在线点餐管理系统(前台、后台)(java+jsp+servlet+jdbc+mysql+tomcat)

运行环境

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

基于javaweb+mysql的JSP+Servlet网上订餐在线点餐管理系统(前台、后台)(java+jsp+servlet+jdbc+mysql+tomcat)

	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

public class UpdateBookServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public UpdateBookServlet() {
		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)

public class PwdNameUserServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public PwdNameUserServlet() {
		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 {
		Validate vd = new Validate();
		String newpwd = vd.getUnicode(request.getParameter("newpwd"));
		String newname = vd.getUnicode(request.getParameter("newname"));
		String name = vd.getUnicode(request.getParameter("name"));
		String pwd = vd.getUnicode(request.getParameter("pwd"));
		String xpwd = vd.getUnicode(request.getParameter("xpwd"));
		String xname = vd.getUnicode(request.getParameter("xname"));
		String xuser = vd.getUnicode(request.getParameter("xuser"));
		String userpwd = vd.getUnicode(request.getParameter("userpwd"));
		String sql = "";
		String str ="";
		InsertUpdateDelBean ib = new InsertUpdateDelBean();
		HttpSession session = request.getSession();
		ArrayList adminlogin = (ArrayList)session.getAttribute("adminlogin");
		ArrayList login = (ArrayList)session.getAttribute("login");
		String id = "";
		if(adminlogin != null && !adminlogin.equals("")){
			id = (String)adminlogin.get(0);
		}
		String userid = "";
		if(login != null && !login.equals("")){
			userid = (String)login.get(0);

public class LeaveWordServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public LeaveWordServlet() {
		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 {
		Validate vd = new Validate();
		String title = vd.getUnicode(request.getParameter("title"));
		String content = vd.getUnicode(request.getParameter("content"));
		HttpSession session = request.getSession();
		ArrayList login = (ArrayList)session.getAttribute("login");
		SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd kk:mm",Locale.getDefault());
		Date currentDate = new Date();
		String lastdate = formatter.format(currentDate);
		String sql = "insert into leaveword(users,title,content,times) values('"+login.get(0)+"','"+title+"','"+content+"','"+lastdate+"')";
                {
                    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);
                m_formRequest.putParameter(s3,s11);
            }
            if((char)m_binArray[m_currentIndex + 1] == '-')
            {
                break;
            }
        }
    }

    public int save(String s) throws ServletException,IOException,SmartUploadException
    {
        return save(s,0);
    }

    public int save(String s,int i) throws ServletException,IOException,SmartUploadException
    {
        int j = 0;
        if(s == null)
        {
            s = m_application.getRealPath("/");
            //System.out.println("s == null,m_application.getRealPath:" + s);
        }
        if(s.indexOf("/") != -1)
        {
            if(s.charAt(s.length() - 1) != '/')
            {
                s = s + "/";
                //System.out.println("m_application.getRealPath::" + s);
            }
        }
        else
        {
            if(s.charAt(s.length() - 1) != '\\')
            {
                s = s + "\\";
                //System.out.println("m_application.getRealPath" + s);
            }
        }
        //System.out.println("m_application.getRealPath:::" + s);
        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)
        {
            throw new IllegalArgumentException("The columnName cannot be empty (1055).");
        }
        byte abyte0[] = resultset.getBytes(s);
        if(s1 == null)
        {
            m_response.setContentType("application/x-msdownload");
        }
        else
        {
            if(s1.length() == 0)
            {
                m_response.setContentType("application/x-msdownload");
            }
            else
            {
                m_response.setContentType(s1);
            }
        }
        m_response.setContentLength(abyte0.length);
        if(s2 == null)
        {
            m_response.setHeader("Content-Disposition","attachment;");
        }
        else
        {
            if(s2.length() == 0)
            {
                m_response.setHeader("Content-Disposition","attachment;");
            }
            else
            {
                m_response.setHeader("Content-Disposition","attachment; filename=" + s2);
            }
        }
        m_response.getOutputStream().write(abyte0,0,abyte0.length);
    }

    public void fieldToFile(ResultSet resultset,String s,String s1) throws ServletException,IOException,SmartUploadException,SQLException
    {
        try
        {
            {
                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)
        {
            throw new IllegalArgumentException("The columnName cannot be empty (1055).");
        }
        byte abyte0[] = resultset.getBytes(s);
        if(s1 == null)
        {
            m_response.setContentType("application/x-msdownload");
        }
        else
        {
            if(s1.length() == 0)

public class PwdNameUserServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public PwdNameUserServlet() {
		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 {
		Validate vd = new Validate();
		String newpwd = vd.getUnicode(request.getParameter("newpwd"));
		String newname = vd.getUnicode(request.getParameter("newname"));
		String name = vd.getUnicode(request.getParameter("name"));
		String pwd = vd.getUnicode(request.getParameter("pwd"));
		String xpwd = vd.getUnicode(request.getParameter("xpwd"));
		String xname = vd.getUnicode(request.getParameter("xname"));
		String xuser = vd.getUnicode(request.getParameter("xuser"));
		String userpwd = vd.getUnicode(request.getParameter("userpwd"));
		String sql = "";
     * @deprecated Method service is deprecated
     */
    public void service(HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException,IOException
    {
        m_request = httpservletrequest;
        m_response = httpservletresponse;
    }

    public final void initialize(ServletConfig servletconfig,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException
    {
        m_application = servletconfig.getServletContext();
        m_request = httpservletrequest;
        m_response = httpservletresponse;
    }

    public final void initialize(PageContext pagecontext) throws ServletException
    {
        m_application = pagecontext.getServletContext();
        m_request = (HttpServletRequest)pagecontext.getRequest();
        m_response = (HttpServletResponse)pagecontext.getResponse();
    }

    /**
     * @deprecated Method initialize is deprecated
     */
    public final void initialize(ServletContext servletcontext,HttpSession httpsession,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse,JspWriter jspwriter) throws ServletException
    {
        m_application = servletcontext;
        m_request = httpservletrequest;
        m_response = httpservletresponse;
    }

    public void upload() throws ServletException,IOException,SmartUploadException
    {
        int i = 0;
        //boolean flag = false;
        boolean flag1 = false;
        //boolean flag2 = false;
        long l = 0L;
        //String s = "";//new String();
        //String s2 = "";//new String();
        String s4 = ""; //new String();
        String s5 = ""; //new String();
        String s6 = ""; //new String();
        String s7 = ""; //new String();
        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
	 *
	 * @throws ServletException if an error occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

public class StockAddServlet extends HttpServlet {

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

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
		String orderda = vd.getUnicode(request.getParameter("orderda"));
		String orderxiao = vd.getUnicode(request.getParameter("orderxiao"));
		String sql = "select a.id as userid,b.id as bookid,c.id as orderid,realname,phone,address,b.name as bookname,booksum,price1,times from users a,books b,orders c where a.id=c.userid and b.id=c.bookid ";
		String[] args = {"userid","bookid","orderid","realname","phone","address","bookname","booksum","price1","times"};
		if(userid != null && !userid.equals("")){
			sql += "and a.id='"+userid+"'";
		}
		if(bookname != null && !bookname.equals("")){
			sql += "and b.name like '%"+bookname+"%'";
		}
		if(orderda != null && !orderda.equals("")){
			sql += "and c.booksum>"+orderda;
		}
		if(orderxiao != null && !orderxiao.equals("")){
			sql += "and c.booksum<"+orderxiao;
		}
		SelectBean sb = new SelectBean();
		ArrayList al = sb.select(sql, args);
		request.setAttribute("order", al);
		RequestDispatcher rd=request.getRequestDispatcher("/admin/order2.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
	}

}


public class OrderListServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public OrderListServlet() {
		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 {
		Validate vd = new Validate();
		String username = vd.getUnicode(request.getParameter("username"));
		String bookname = vd.getUnicode(request.getParameter("bookname"));
		String sql = "select a.name as username,realname,b.name as bookname,c.* from users a,books b,loanbook c where a.id=c.users and b.id=c.books ";
		String[] args = {"username","realname","bookname","id","users","books","price","sumday","begintime","endtime","continueday","continuetime","flag"};
		
		if(username != null && !username.equals("")){
			sql += "and a.name like '%"+username+"%'";
		}
		if(bookname != null && !bookname.equals("")){
			sql += "and b.name like '%"+bookname+"%'";
		}
		
		SelectBean sb = new SelectBean();
		ArrayList al = sb.select(sql, args);
		request.setAttribute("order", al);
		RequestDispatcher rd=request.getRequestDispatcher("/admin/order.jsp");
        rd.forward(request,response);
	}

            }
        }

        if(isVirtual(s))
        {
            s = m_application.getRealPath(s);
        }
        try
        {
            java.io.File file = new java.io.File(s);
            FileOutputStream fileoutputstream = new FileOutputStream(file);
            fileoutputstream.write(m_binArray);
            fileoutputstream.close();
        }
        catch(Exception exception1)
        {
            throw new SmartUploadException("The Form cannot be saved in the specified file (1030).");
        }
    }

    private boolean isVirtual(String s)
    {
        if(m_application.getRealPath(s) != null)
        {
            java.io.File file = new java.io.File(m_application.getRealPath(s));
            return file.exists();
        }
        else
        {
            return false;
        }
    }
}

            }
        }
        m_currentIndex = m_endData + k + 3;
    }

    private String getDataHeader()
    {
        //boolean flag = false;
        int i = m_currentIndex;
        int j = 0;
        for(boolean flag1 = false;!flag1;)
        {
            if(m_binArray[m_currentIndex] == 13 && m_binArray[m_currentIndex + 2] == 13)
            {
                flag1 = true;
                j = m_currentIndex - 1;
                m_currentIndex = m_currentIndex + 2;
            }
            else
            {
                m_currentIndex++;
            }
        }

        String s = new String(m_binArray,i,(j - i) + 1);
        return s;
    }

    private String getFileName(String s)
    {
        //String s1 = ""; // = new String();
        //String s2 = ""; // = new String();
        //boolean flag = false;
        //boolean flag1 = false;
        //boolean flag2 = false;
        int i = 0;
        i = s.lastIndexOf('/');
        if(i != -1)
        {
            return s.substring(i + 1,s.length());
        }
        i = s.lastIndexOf('\\');
        if(i != -1)
        {
            return s.substring(i + 1,s.length());
        }
        else
		doGet(request, response);
	}

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

}

public class EmpAddServlet extends HttpServlet {

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

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}
        m_endData = 0;
        while(i < m_totalBytes)
        {
            if(m_binArray[i] == (byte)m_boundary.charAt(j))
            {
                if(j == k - 1)
                {
                    m_endData = ((i - k) + 1) - 3;
                    break;
                }
                i++;
                j++;
            }
            else
            {
                i++;
                j = 0;
            }
        }
        m_currentIndex = m_endData + k + 3;
    }

    private String getDataHeader()
    {
        //boolean flag = false;
        int i = m_currentIndex;
        int j = 0;
        for(boolean flag1 = false;!flag1;)
        {
            if(m_binArray[m_currentIndex] == 13 && m_binArray[m_currentIndex + 2] == 13)
            {
                flag1 = true;
                j = m_currentIndex - 1;
                m_currentIndex = m_currentIndex + 2;
            }
            else
            {
                m_currentIndex++;
            }
        }

        String s = new String(m_binArray,i,(j - i) + 1);
        return s;
    }

    private String getFileName(String s)
    {
        //String s1 = ""; // = new String();
        //String s2 = ""; // = new String();
        //boolean flag = false;
        }
        return s3;
    }

    private String getFileExt(String s)
    {
        String s1; // = new String();
        int i = 0;
        int j = 0;
        if(s == null)
        {
            return null;
        }
        i = s.lastIndexOf('.') + 1;
        j = s.length();
        s1 = s.substring(i,j);
        if(s.lastIndexOf('.') > 0)
        {
            return s1;
        }
        else
        {
            return "";
        }
    }

    private String getContentType(String s)
    {
        String s1 = ""; // = new String();
        String s2 = ""; // = new String();
        int i = 0;
        //boolean flag = false;
        s1 = "Content-Type:";
        i = s.indexOf(s1) + s1.length();
        if(i != -1)
        {
            int j = s.length();
            s2 = s.substring(i,j);
        }
        return s2;
    }

    private String getTypeMIME(String s)
    {
        //String s1 = new String();
        int i = 0;
        i = s.indexOf("/");
        if(i != -1)
        {

public class PwdNameUserServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public PwdNameUserServlet() {
		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 {
		Validate vd = new Validate();
		String newpwd = vd.getUnicode(request.getParameter("newpwd"));
		String newname = vd.getUnicode(request.getParameter("newname"));
		String name = vd.getUnicode(request.getParameter("name"));
		String pwd = vd.getUnicode(request.getParameter("pwd"));
		String xpwd = vd.getUnicode(request.getParameter("xpwd"));
		String xname = vd.getUnicode(request.getParameter("xname"));
		String xuser = vd.getUnicode(request.getParameter("xuser"));
		String userpwd = vd.getUnicode(request.getParameter("userpwd"));
		String sql = "";
		String str ="";
		InsertUpdateDelBean ib = new InsertUpdateDelBean();
		HttpSession session = request.getSession();
		ArrayList adminlogin = (ArrayList)session.getAttribute("adminlogin");
		ArrayList login = (ArrayList)session.getAttribute("login");
		String id = "";
		if(adminlogin != null && !adminlogin.equals("")){
			id = (String)adminlogin.get(0);
		}
		String userid = "";
		if(kuxiao != null && !kuxiao.equals("")){
			sql += "where storage<"+kuxiao;
		}
		if(souda != null && !souda.equals("")){
			sql += "where sums>"+souda;
		}
		if(souxiao != null && !souxiao.equals("")){
			sql += "where sums<"+souxiao;
		}
		SelectBean sb = new SelectBean();
		ArrayList al = sb.select(sql, args);
		request.setAttribute("books", al);
		RequestDispatcher rd=request.getRequestDispatcher("/admin/kuxiao.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
	}

}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值