基于javaweb+mysql的jsp+servlet旅游管理系统(java+jsp+javascript+servlet+struts+mysql)

基于javaweb+mysql的jsp+servlet旅游管理系统(java+jsp+javascript+servlet+struts+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的JSP+Servlet旅游管理系统(java+jsp+javascript+servlet+struts+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版本; 6.是否Maven项目:否;

技术栈

1.后端:servlet+struts 2.前端:JSP+CSS+JavaScript+jsp+mysql

使用说明

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

public class NewsAction extends HttpServlet {

	private ServletConfig config;
	/**
	 * Constructor of the object.
	 */
	public NewsAction() {
		super();
	}

	final public void init(ServletConfig config) throws ServletException
    {
        this.config = config;  
    }

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
    {
        downloadFile(s,s1,s2,65000);
    }

    public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException
    {
        if(s == null)
        {
            throw new IllegalArgumentException("File '" + s + "' not found (1040).");
        }
        if(s.equals(""))
        {
            throw new IllegalArgumentException("File '" + s + "' not found (1040).");
        }
        if(!isVirtual(s) && m_denyPhysicalPath)
        {
            throw new SecurityException("Physical path is denied (1035).");
        }
        if(isVirtual(s))
        {
            s = m_application.getRealPath(s);
        }
        java.io.File file = new java.io.File(s);
        FileInputStream fileinputstream = new FileInputStream(file);
        long l = file.length();
        //boolean flag = false;
        int k = 0;
        byte abyte0[] = new byte[i];
        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((int)l);
        m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
        if(s2 == null)
        {
            m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
        }
        else
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType(Constant.CONTENTTYPE);
		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		String sysdir = new SystemBean().getDir();
		HttpSession session = request.getSession();
		String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
		try{
			String username2 = (String)session.getAttribute("user");
			 
				String method = request.getParameter("method").trim();
				if(method.equals("addNews")){
					String title = request.getParameter("title");
					String fenlei = request.getParameter("fenlei");
							else if(method.equals("DELALLUSE")){//来自所有在用会员页面
								request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
							}
						}
						else{
							if(method.equals("DELMEMBER")){//来自所有个人会员页面
								 request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
							}
							else if(method.equals("DELCO")){//来自所有企业会员页面
								 request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
							}
							else if(method.equals("DELTODAY")){//来自今日注册会员页面
								 request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
							}
							else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
								 request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
							}
							else if(method.equals("DELALLUSE")){//来自所有在用会员页面
								 request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
							}
						}
					}
				}
				else if(method.equals("CLOSE")){
					String id=request.getParameter("id").trim();
					int flag=mmBean.closeMember(Integer.parseInt(id));
					if(flag==Constant.SUCCESS){
						request.setAttribute("message", "操作成功!");
						request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
					}
					else{
						request.setAttribute("message", "系统维护中,请稍后再试!");
						request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
					}
				}
				else{
					request.getRequestDispatcher("error.jsp").forward(request, response);
				}
			}
		}catch(Exception e){

public class NewsAction extends HttpServlet {

	private ServletConfig config;
	/**
	 * Constructor of the object.
	 */
	public NewsAction() {
		super();
	}

	final public void init(ServletConfig config) throws ServletException
    {
        this.config = config;  
    }

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 

    public void downloadFile(String s) throws ServletException,IOException,SmartUploadException
    {
        downloadFile(s,null,null);
    }

    public void downloadFile(String s,String s1) throws ServletException,IOException,SmartUploadException,SmartUploadException
    {
        downloadFile(s,s1,null);
    }

    public void downloadFile(String s,String s1,String s2) throws ServletException,IOException,SmartUploadException
    {
        downloadFile(s,s1,s2,65000);
    }

    public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException
    {
        if(s == null)
        {
            throw new IllegalArgumentException("File '" + s + "' not found (1040).");
        }
        if(s.equals(""))
        {
            throw new IllegalArgumentException("File '" + s + "' not found (1040).");
        }
        if(!isVirtual(s) && m_denyPhysicalPath)
        {
            throw new SecurityException("Physical path is denied (1035).");
        }
        if(isVirtual(s))
        {
            s = m_application.getRealPath(s);
        }
        java.io.File file = new java.io.File(s);
        FileInputStream fileinputstream = new FileInputStream(file);
        long l = file.length();
        //boolean flag = false;
        int k = 0;
        byte abyte0[] = new byte[i];
        if(s1 == null)
        {
            m_response.setContentType("application/x-msdownload");
        }
							int s = Integer.parseInt(check[i]);				
							id[i] = s;
						}
						int flag = mmBean.delMember(id);
						if(flag == Constant.SUCCESS){
							if(method.equals("DELMEMBER")){//来自所有个人会员页面
								request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
							}
							else if(method.equals("DELCO")){//来自所有企业会员页面
								request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
							}
							else if(method.equals("DELTODAY")){//来自今日注册会员页面
								request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
							}
							else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
								request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
							}
							else if(method.equals("DELALLUSE")){//来自所有在用会员页面
								request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
							}
						}
						else{
							if(method.equals("DELMEMBER")){//来自所有个人会员页面
								 request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
							}
							else if(method.equals("DELCO")){//来自所有企业会员页面
								 request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
							}
							else if(method.equals("DELTODAY")){//来自今日注册会员页面
								 request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
							}
							else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
								 request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
							}
							else if(method.equals("DELALLUSE")){//来自所有在用会员页面
								 request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
							}
						}
					}
				}
				else if(method.equals("CLOSE")){
					String id=request.getParameter("id").trim();
					int flag=mmBean.closeMember(Integer.parseInt(id));
					if(flag==Constant.SUCCESS){
						request.setAttribute("message", "操作成功!");
    }

    public int getSize()
    {
        return m_totalBytes;
    }

    public byte getBinaryData(int i)
    {
        byte byte0;
        try
        {
            byte0 = m_binArray[i];
        }
        catch(Exception exception)
        {
            throw new ArrayIndexOutOfBoundsException("Index out of range (1005).");
        }
        return byte0;
    }

    public SmartFiles getFiles()
    {
        return m_files;
    }

    public SmartRequest getRequest()
    {
        return m_formRequest;
    }

    public void downloadFile(String s) throws ServletException,IOException,SmartUploadException
    {
        downloadFile(s,null,null);
    }

    public void downloadFile(String s,String s1) throws ServletException,IOException,SmartUploadException,SmartUploadException
    {
        downloadFile(s,s1,null);
    }

    public void downloadFile(String s,String s1,String s2) throws ServletException,IOException,SmartUploadException
							else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
								request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
							}
							else if(method.equals("DELALLUSE")){//来自所有在用会员页面
								request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
							}
						}
						else{
							if(method.equals("DELMEMBER")){//来自所有个人会员页面
								 request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
							}
							else if(method.equals("DELCO")){//来自所有企业会员页面
								 request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
							}
							else if(method.equals("DELTODAY")){//来自今日注册会员页面
								 request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
							}
							else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
								 request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
							}
							else if(method.equals("DELALLUSE")){//来自所有在用会员页面
								 request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
							}
						}
					}
				}
				else if(method.equals("CLOSE")){
					String id=request.getParameter("id").trim();
					int flag=mmBean.closeMember(Integer.parseInt(id));
					if(flag==Constant.SUCCESS){
						request.setAttribute("message", "操作成功!");
						request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
					}
					else{
						request.setAttribute("message", "系统维护中,请稍后再试!");
						request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
					}
				}
				else{
					request.getRequestDispatcher("error.jsp").forward(request, response);
				}
			}
		}catch(Exception e){
			request.getRequestDispatcher("error.jsp").forward(request, response);
		}
	}

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

}
package com.action;

/**
 * 前台会员登录 退出
 * 
 */

public class LoginAction extends HttpServlet {

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

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
        downloadFile(s,s1,s2,65000);
    }

    public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException
    {
        if(s == null)
        {
            throw new IllegalArgumentException("File '" + s + "' not found (1040).");
        }
        if(s.equals(""))
        {
            throw new IllegalArgumentException("File '" + s + "' not found (1040).");
        }
        if(!isVirtual(s) && m_denyPhysicalPath)
        {
            throw new SecurityException("Physical path is denied (1035).");
        }
        if(isVirtual(s))
        {
            s = m_application.getRealPath(s);
        }
        java.io.File file = new java.io.File(s);
        FileInputStream fileinputstream = new FileInputStream(file);
        long l = file.length();
        //boolean flag = false;
        int k = 0;
        byte abyte0[] = new byte[i];
        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((int)l);
        m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
        if(s2 == null)
        {
            m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
	}

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType(Constant.CONTENTTYPE);
		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		String sysdir = new SystemBean().getDir();
		HttpSession session = request.getSession();
		try{
			String username2 = (String)session.getAttribute("user");
			if(username2 == null){
					if(reg_type.equals("person")){//如果是个人会员
						request.getRequestDispatcher("personreg.jsp").forward(request, response);
					}
					else if(reg_type.equals("co")){//如果是企业会员
						request.getRequestDispatcher("coreg.jsp").forward(request, response);
					}
					else{
						request.getRequestDispatcher("index.jsp").forward(request, response);
					}
				}
				else if(flag == Constant.SAME_NAME){
					request.setAttribute("username", username);
					request.setAttribute("message", "对不起,该用户名已存在,请重新选择!");
					request.getRequestDispatcher("reg2.jsp").forward(request, response);
				}
				else{
					request.setAttribute("message", "系统维护中,请稍后再试!");
					request.getRequestDispatcher("reg2.jsp").forward(request, response);
				}
			}
			
			
		}
		else if(method.equals("checksame")){//检查注册名是否可用
			String username = Filter.escapeHTMLTags(request.getParameter("username").trim());
			if(username.trim().equals("admin")){
				request.setAttribute("username", username);
				request.setAttribute("message", "非法的用户名,请重新选择!");
				request.getRequestDispatcher("reg2.jsp").forward(request, response);
			}
			else{
				int flag = memberBean.checkRegName(username);
				if(flag == Constant.SUCCESS){
					request.setAttribute("username", username);
					request.setAttribute("message", "恭喜您,这个名字可以使用!");
					request.getRequestDispatcher("reg2.jsp").forward(request, response);
				}
				else if(flag == Constant.SAME_NAME){
					request.setAttribute("username", username);
					request.setAttribute("message", "对不起,该用户名已存在,请重新选择!");
					request.getRequestDispatcher("reg2.jsp").forward(request, response);
				}
				else{
					request.setAttribute("message", "系统维护中,请稍后再试!");
					request.getRequestDispatcher("reg2.jsp").forward(request, response);
				}
            }
        }
        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)
        {
				request.setAttribute("message", "系统维护中,请稍后再试!");
				return (mapping.findForward("admin/hzp/hot.jsp"));  
			}
		}
		else if(method.equals("tejiadeltrave")){
			String id=request.getParameter("id").trim();
			int flag = tb.delTrave(id);
			if(flag == Constant.SUCCESS){
				request.setAttribute("message", "操作成功!");
				return (mapping.findForward("admin/hzp/tejia.jsp"));  
			}
			else{
				request.setAttribute("message", "系统维护中,请稍后再试!");
				return (mapping.findForward("admin/hzp/tejia.jsp"));  
			}
		}
		else if(method.equals("tuijiandeltrave")){
			String id=request.getParameter("id").trim();
			int flag = tb.delTrave(id);
			if(flag == Constant.SUCCESS){
				request.setAttribute("message", "操作成功!");
				return (mapping.findForward("admin/hzp/tuijian.jsp"));   
			}
			else{
				request.setAttribute("message", "系统维护中,请稍后再试!");
				return (mapping.findForward("admin/hzp/tuijian.jsp"));   
			}
		}
		 
		else if(method.equals("addType")){
			String type=request.getParameter("type").trim();
			int flag=tb.addType(type);
			if(flag == Constant.SUCCESS){
				request.setAttribute("message", "操作成功!");
				return (mapping.findForward("admin/hzp/type.jsp"));   
			}
			else if(flag==Constant.DEFAULT_ERROR){
				request.setAttribute("message", "该分类已存在!");
				return (mapping.findForward("admin/hzp/type.jsp"));   
			}
			else{
				request.setAttribute("message", "系统维护中,请稍后再试!");
				return (mapping.findForward("admin/hzp/type.jsp"));   
			}
		}
		else if(method.equals("delType")){
			String id=request.getParameter("id").trim();
			int flag=tb.delType(id);
			if(flag == Constant.SUCCESS){
				request.setAttribute("message", "操作成功!");
				return (mapping.findForward("admin/hzp/type.jsp"));   
			}
	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType(Constant.CONTENTTYPE);
		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		String sysdir = new SystemBean().getDir();
		HttpSession session = request.getSession();
		try{
			String username2 = (String)session.getAttribute("user");
			if(username2 == null){
				request.getRequestDispatcher("error.jsp").forward(request, response);
			}
			else{
				String method = request.getParameter("method").trim();
				
				/**********************************************
				 * 新闻
				 ************************************************/
				if(method.equals("DELNEWS")){//删除新闻 来自普通新闻页面index.jsp
					String strDirPath = request.getSession().getServletContext().getRealPath("/");
					String check[] = request.getParameterValues("checkit");
        			if(check == null){
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType(Constant.CONTENTTYPE);
		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		HttpSession session = request.getSession();
		MemberBean memberBean = new MemberBean();
		String method = Filter.escapeHTMLTags(request.getParameter("method").trim());
		/*********************************************
		 * 会员注册通用(检查用户名 修改密码 reg2.jsp页面跳转)
		 *********************************************/
		if(method.equals("reg2")){//会员注册 reg2.jsp
			String username = Filter.escapeHTMLTags(request.getParameter("username").trim());
			String password = Filter.escapeHTMLTags(request.getParameter("password").trim());
			String reg_type = Filter.escapeHTMLTags(request.getParameter("reg_type").trim());
			request.setAttribute("username", username);
			request.setAttribute("password", password);
			request.setAttribute("reg_type", reg_type);
			if(username.trim().equals("admin")){
				request.setAttribute("username", username);
				request.setAttribute("message", "非法的用户名,请重新选择!");
				request.getRequestDispatcher("reg2.jsp").forward(request, response);
			}
			else{
				int flag = memberBean.checkRegName(username);
				if(flag == Constant.SUCCESS){
					if(reg_type.equals("person")){//如果是个人会员
						request.getRequestDispatcher("personreg.jsp").forward(request, response);
					}
					else if(reg_type.equals("co")){//如果是企业会员
						request.getRequestDispatcher("coreg.jsp").forward(request, response);
					}
					else{
						request.getRequestDispatcher("index.jsp").forward(request, response);
					}
 */

public class AfficheAction extends HttpServlet {

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

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
        {
            flag = true;
        }
        if(i == 0)
        {
            if(isVirtual(s1))
            {
                s1 = m_application.getRealPath(s1);
                if(s1.endsWith(s3))
                {
                    s1 = s1 + s2;
                }
                else
                {
                    s1 = s1 + s3 + s2;
                }
                return s1;
            }
            if(flag)
            {
                if(m_denyPhysicalPath)
                {
                    throw new IllegalArgumentException("Physical path is denied (1125).");
                }
                else
                {
                    return s;
                }
            }
            else
            {
                throw new IllegalArgumentException("This path does not exist (1135).");
            }
        }
        if(i == 1)
        {
            if(isVirtual(s1))
            {
                s1 = m_application.getRealPath(s1);
                if(s1.endsWith(s3))
                {
                    s1 = s1 + s2;
                }
                else
                {
                    s1 = s1 + s3 + s2;
                }
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
package com.action;

/**
 * 会员注册、修改资料等
 *
 */

public class MemberAction extends HttpServlet {

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

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

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

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

        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
        {
            if(m_application.getRealPath(s1) != null)
            {
                s1 = m_application.getRealPath(s1);
            }
        			if(check == null){
						request.setAttribute("message", "请选择要删除的记录!");
						request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
					}
					else{
						int id2[]= new int[check.length];
						for(int i = 0;i<check.length;i++){
							int s = Integer.parseInt(check[i]);				
							id2[i] = s;
						}
						int flag = new NewsBean().delNews(id2); 
						if(flag == Constant.SUCCESS){
							request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
						}
						else{
							request.setAttribute("message", "系统维护中,请稍后再试!");
							request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
						}
					}
				}
				else if(method.equals("HIDENEWS")){//隐藏、显示新闻 来自普通新闻页面index.jsp
					String id = Filter.escapeHTMLTags(request.getParameter("id").trim());
					int flag = new NewsBean().hideNews(Integer.parseInt(id));
					if(flag == Constant.SUCCESS){
						request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
					}
					else{
						request.setAttribute("message", "系统维护中,请稍后再试!");
						request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
					}
				}
				else if(method.equals("UPNEWS")){//置顶 新闻 来自普通新闻页面index.jsp
					String id = Filter.escapeHTMLTags(request.getParameter("id").trim());
					int flag = new NewsBean().upNews(Integer.parseInt(id));
					if(flag == Constant.SUCCESS){
						request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
					}
					else{
						request.setAttribute("message", "系统维护中,请稍后再试!");
						request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
					}
				}
//				if(method.equals("DELUPNEWS")){//删除新闻 来自置顶新闻页面up.jsp
//					String strDirPath = request.getSession().getServletContext().getRealPath("/");
//					String check[] = request.getParameterValues("checkit");
//        			if(check == null){
//						request.setAttribute("message", "请选择要删除的记录!");
//						request.getRequestDispatcher(sysdir+"/news/up.jsp").forward(request, response);
//					}
//					else{
//						int id2[]= new int[check.length];
//						for(int i = 0;i<check.length;i++){
//							int s = Integer.parseInt(check[i]);				
//							id2[i] = s;
        //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
            {
                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
            {
                m_boundary = m_boundary + (char)m_binArray[m_currentIndex];

            }
        }
        if(m_currentIndex == 1)
        {
            return;
        }
        for(m_currentIndex++;m_currentIndex < m_totalBytes;m_currentIndex = m_currentIndex + 2)
        {
        	long now=new java.util.Date().getTime();
            String s1 = getDataHeader();
            m_currentIndex = m_currentIndex + 2;
            boolean flag3 = s1.indexOf("filename") > 0;
            String s3 = getDataFieldValue(s1,"name");
            if(flag3)
            {
	}

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

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType(Constant.CONTENTTYPE);
		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		String sysdir = new SystemBean().getDir();
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		response.setContentType(Constant.CONTENTTYPE);
		HttpSession session=request.getSession();
		HzpBean tb=new HzpBean();
		String method=request.getParameter("method").trim();
		/ 
		if(method.equals("deltrave")){
			String id=request.getParameter("id").trim();
			int flag = tb.delTrave(id);
			if(flag == Constant.SUCCESS){
				request.setAttribute("message", "操作成功!");
				request.getRequestDispatcher("admin/hzp/index.jsp").forward(request, response);
			}
			else{
				request.setAttribute("message", "系统维护中,请稍后再试!");
				request.getRequestDispatcher("admin/hzp/index.jsp").forward(request, response);
			}
		}

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、项目简介本课程演示的是一套基于SSM实现的旅游管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者。课程包含:1. 项目源码、项目文档、数据库脚本、软件工具等所有资料2. 带你从零开始部署运行本套系统3. 该项目附带的源码资料可作为毕设使用4. 提供技术答疑二、技术实现后台框架:Spring、SpringMVC、MyBatisUI界面:JSP、jQuery 、BootStrap数据库:MySQL 三、系统功能本系统分为前台旅游界面和后台管理,包含三种角色:注册用户、旅游公司和管理员系统的功能模块如下: 1.登陆注册模块 管理员的登录模块:管理员登录系统对本系统其他管理模块进行管理。 用户的登录模块:用户登录本系统,对个人的信息等进行查询,操作可使用的功能。 用户注册模块:游客用户可以进行用户注册,系统会反馈是否注册成功。 添加管理员模块:向本系统中添加更多的管理人员,管理员包括普通管理员和超级管理员。 2.景点信息管理模块: 景点信息列表:将数据库的景点信息表以列表的形式呈现给管理员。 添加景点信息:实现管理员添加景点信息。 修改景点信息:实现管理员修改景点信息。 3.公告文章管理模块: 公告文章列表:将数据库的公告文章表以列表的形式呈现给管理员。 添加公告文章:实现管理员添加公告文章。 修改公告文章:实现管理员修改公告文章。 4.旅游线路管理模块: 旅游线路列表:显示系统的所有旅游线路,可以通过关键字查询。 旅游线路删除:对输入错误或过期的旅游线路删除。 5.变幻图管理模块: 变幻图列表:显示系统的所有变幻图,可以通过关键字查询。 变幻图删除:对输入错误或过期的变幻图删除。 6.用户模块: 资料管理:用户登录本系统。可以对自己的个人主页进行查看。 系统信息:用户可以查看自己的系统提示信息。 修改资料:用户可以修改自己的账号密码。 信息搜索:用户可以通过关键字搜索站内信息。 密码修改:用户可以修改个人登录密码。 7.系统管理模块 8.退出模块该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。四、项目截图1)前台首页2)旅游景点详情3)旅游线路报名4)系统后台登陆5)后台管理界面  更多Java毕设项目请关注【毕设系列课程】https://edu.csdn.net/lecturer/2104   

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值