Java项目:JSP民宿预订网站信息管理平台

news2025/8/11 16:31:45

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目为前后台,包括管理员与普通用户两种角色;

管理员角色包含以下功能:

管理员登录,用户管理,会员管理,民宿信息管理,新闻管理,留言管理等功能。

用户角色包含以下功能:
用户登录与注册,查看网站新闻,查看民宿信息,查看留言板,修改个人信息,提交订单,查看我的订单等功能。

环境需要

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项目:否;

技术栈

JSP+CSS+JavaScript+mysql+servlet

使用说明

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

管理员账号/密码:admin/admin

运行截图

用户角色

 管理员角色

  

相关代码 

YudingJiuAction

package com.biyeseng.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.biyeseng.db.DBManager;
import java.sql.*;
import java.util.Date;

/**
 * 修改新闻
 * 
 * @author win7
 * 
 */
public class YudingJiuAction extends HttpServlet {

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

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

	/**
	 * 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("text/html");
		PrintWriter out = response.getWriter();
		String name=request.getParameter("name");
		String fang=request.getParameter("fang");
		String count=request.getParameter("count");
		String bdate=request.getParameter("bdate");
		String edate=request.getParameter("edate");
		String tel=request.getParameter("tel");
		String fangkuan=request.getParameter("fangkuan");
		String dingjin=request.getParameter("dingjin");
		String ism=request.getParameter("ism");
		String mtel=request.getParameter("mtel");

		String sql = "insert into yuding(name,fang,count,bdate,edate,tel,fangkuan,dingjin,ism,mtel) values('"+name+"','"+fang+"','"+count+"','"+bdate+"','"+edate+"','"+tel+"','"+fangkuan+"','"+dingjin+"','"+ism+"','"+mtel+"')";
		System.out.println(sql);

		Statement stat = null;
		Connection conn = null;
		DBManager dbm = new DBManager();
		try {
			conn = dbm.getConnection();
			stat = conn.createStatement();
			stat.execute(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (stat != null)
					stat.close();
				if (conn != null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		out
				.println("<script>alert('预订民宿成功,客服人员会尽快和您联系谢谢!');window.location.href='jiudian.jsp'</script>");
		out.flush();
		out.close();
	}

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

		this.doPost(request, response);
	}

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

}

AddAdminAction

package com.biyeseng.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.biyeseng.db.DBManager;

/**
 * 添加管理员
 * @author win7
 *
 */
public class AddAdminAction extends HttpServlet {

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

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

	/**
	 * 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("text/html");
		PrintWriter out = response.getWriter();
		String name=request.getParameter("name");
		String pwd=request.getParameter("pwd");
		String zhi=request.getParameter("zhi");
		String tel=request.getParameter("tel");
		String age=request.getParameter("age");
		
		DBManager dbm = new DBManager();
		//插入管理员信息表
		String sql = "insert into admin(userName,userPw,zhi,tel,age)  values('"+name+"','"+pwd+"','"+zhi+"','"+tel+"','"+age+"')";

		Statement stat = null;
		Connection conn=null;
		try {
			conn=dbm.getConnection();
			stat = conn.createStatement();
			System.out.println(sql);
			stat.execute(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if(stat!=null)
					stat.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		response.sendRedirect("admin/admin/list.jsp");
		out.flush();
		out.close();
	}

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

}

AddJiudianAction

package com.biyeseng.action;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import com.biyeseng.db.DBManager;

public class AddJiudianAction extends HttpServlet {

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

		this.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("UTF-8");
		
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();

		DBManager dbm = new DBManager();
		
		String name=request.getParameter("name");
		String dizhi=request.getParameter("dizhi");
		String info=request.getParameter("info");
		String pic=request.getParameter("fujian");
		String tel=request.getParameter("tel");
		String style=request.getParameter("style");

		
	 
		
		String date = new Date().toLocaleString();
		Object user = request.getSession().getAttribute("user");

		String appuser = "";
		if (user != null && appuser.toString() != null) {
			appuser = (String) user;
		}
		if(pic != null) {
			pic = pic.replaceAll("/upload", "upload");
		}
		
		

		String sql = "insert into jiudian(name,dizhi,info,pic,tel,style) values('"+name+"','"+dizhi+"','"+info+"','"+pic+"','"+tel+"','"+style+"')";
		Statement stat = null;
		Connection conn = null;
		try {
			conn = dbm.getConnection();
			stat = conn.createStatement();
			System.out.println(sql);
			stat.execute(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (stat != null)
					stat.close();
				if (conn != null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		response.sendRedirect("admin/jiudian/list.jsp");

		
		out.flush();
		out.close();
	}

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

}

AddKefangAction

package com.biyeseng.action;	
	
import java.io.IOException;	
import java.io.PrintWriter;	
import java.sql.*;	
	
import javax.servlet.ServletException;	
import javax.servlet.http.HttpServlet;	
import javax.servlet.http.HttpServletRequest;	
import javax.servlet.http.HttpServletResponse;	
	
import com.biyeseng.db.DBManager;	
	
/**	
 * 添加部门	
 * @author win7	
 *	
 */	
public class AddKefangAction extends HttpServlet {	
	
	/**	
	 * Constructor of the object.	
	 */	
	public AddKefangAction() {	
		super();	
	}	
	
	/**	
	 * Destruction of the servlet. <br>	
	 */	
	public void destroy() {	
		super.destroy(); // Just puts "destroy" string in log	
		// Put your code here	
	}	
	
	/**	
	 * 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("text/html");	
		PrintWriter out = response.getWriter();	
		String jid=request.getParameter("jid");
		String name=request.getParameter("name");
		String chuang=request.getParameter("chuang");
		String ren=request.getParameter("ren");
		String price=request.getParameter("price");
		String type=request.getParameter("type");
		String state="";
		DBManager dbm = new DBManager();	
		String sql = "insert into kefang(jid,name,chuang,ren,price,type,state) values("+jid+",'"+name+"','"+chuang+"','"+ren+"','"+price+"','"+type+"','"+state+"')";	
		System.out.println(sql);	
	
		Statement stat = null;	
		Connection conn=null;	
		try {	
			conn=dbm.getConnection();	
			stat = conn.createStatement();	
			stat.execute(sql);	
		} catch (SQLException e) {	
			// TODO Auto-generated catch block	
			e.printStackTrace();	
		} finally {	
			try {	
				if(stat!=null)	
					stat.close();	
				if(conn!=null)	
					conn.close();	
			} catch (SQLException e) {	
				// TODO Auto-generated catch block	
				e.printStackTrace();	
			}	
		}	
		response.sendRedirect("admin/kefang/list.jsp?jid="+jid);	
		out.flush();	
		out.close();	
	}	
	
	/**	
	 * Initialization of the servlet. <br>	
	 *	
	 * @throws ServletException if an error occurs	
	 */	
	public void init() throws ServletException {	
		// Put your code here	
	}	
	
}	

如果也想学习本系统,下面领取。关注并回复:066jsp

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/33760.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

高斯消元总结

A-Matrix Equation_第 45 届国际大学生程序设计竞赛&#xff08;ICPC&#xff09;亚洲区域赛&#xff08;济南&#xff09;&#xff08;重现赛&#xff09; 自己写一个2维矩阵或者3维矩阵就可以发现对于每一列来说都是独立的&#xff0c;每一列的n个Cij都是都关系的&#xff0c…

Sentinel熔断降级

Sentinel熔断降级 1、介绍 官网地址&#xff1a;https://github.com/alibaba/Sentinel/wiki/熔断降级 Sentinel 提供以下几种熔断策略&#xff1a; 慢调用比例 (SLOW_REQUEST_RATIO)&#xff1a;选择以慢调用比例作为阈值&#xff0c;需要设置允许的慢调用 RT&#xff08;即最…

cesium for ue5中actor的cesium georeference组件的改变

今天&#xff0c;重新回顾下cesium for ue的教程&#xff0c;actor添加cesium georeference组件 发现在ue5中&#xff0c;没有这个组件了&#xff0c; 忍住卸载ue5&#xff0c;重新安装ue4.27的冲动&#xff0c;cesium的组件数量增多了&#xff0c;反而功能减少了&#xff…

hive的安装配置及使用

hive需要MySQL和hadoop的支持 文章目录hive需要MySQL和hadoop的支持安装完毕MySQL之后下载并解压hive添加系统环境变量配置hive修改 vim hive-env.sh修改hive-site.xml(1、简化配置&#xff08;推荐&#xff09;)修改hive-site.xml(2、在简化的基础上添加了部分配置)下载一个my…

Java项目:JSP药店药品商城管理系统

作者主页&#xff1a;源码空间站2022 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文末获取源码 项目介绍 本项目分为前后台&#xff0c;分为管理员与普通用户两种角色&#xff0c;管理员登录后台&#xff0c;普通用户登录前台&#xff1b; 管理员角色…

VMware使用教程

文章目录下载软件安装软件新建虚拟机自定义安装下载软件 下载VMware软件&#xff08;应该是需要许可证/密钥的&#xff0c;时间长有点忘了&#xff0c;当然建议买&#xff0c;拒绝白嫖&#xff0c;保护产权&#xff08;可以直接百度搜doge&#xff09;&#xff09;。 安装软件…

Sentinel流控规则

Sentinel流控规则 1、基本介绍 资源名&#xff1a;唯一名称&#xff0c;默认请求路径(如&#xff1a;http://localhost:8089/testA) 针对来源&#xff1a;Sentinel可以针对调用者进行限流&#xff0c;填写微服务名&#xff0c;指定对哪个微服务进行限流 &#xff0c;默认defa…

Bioinformatics2021 | FraGAT+:基于分子原始片段的多尺度图注意力机制的分子性质预测模型

原文标题&#xff1a;FraGAT: a fragment-oriented multi-scale graph attention model for molecular property prediction 论文地址&#xff1a;FraGAT: a fragment-oriented multi-scale graph attention model for molecular property prediction | Bioinformatics | Oxfo…

Windows OpenGL ES 图像阴影

目录 一.OpenGL ES 图像阴影 1.原始图片2.效果演示 二.OpenGL ES 图像阴影源码下载三.猜你喜欢 零基础 OpenGL ES 学习路线推荐 : OpenGL ES 学习目录 >> OpenGL ES 基础 零基础 OpenGL ES 学习路线推荐 : OpenGL ES 学习目录 >> OpenGL ES 特效 零基础 OpenGL E…

SuperMap 云原生动态伸缩不可用该如何解决

最近碰到个别用户在ARM环境国产化操作系统中使用SuperMap iManager for K8S的时候出现服务节点伸缩不生效的问题。今天咱们就以此例来给大家讲解下如何解决该问题。 问题现象&#xff1a;在云套件服务节点管理中&#xff0c;设置伸缩为动态伸缩&#xff0c;设置阈值条件后&…

web前端-javascript-自增++和自减--(a++和++a,都在自身基础上+1,a--和--a都在自增基础上-1,自增和自减的练习)

文章目录自增和自减--1. 自增 1.1 通过自增可以使变量在自身的基础上增加1.2 对一个变量自增以后&#xff0c;原变量的值会立即自增 11.3 自增分为两种&#xff0c;&#xff1a;后(a) 和 前(a)2. 自减 --2.1 通过自减可以使变量在自身的基础上减 12.2 自减分成两种&#xff0c;…

(热门)智慧社区助力实现社区数字化转型

社区是人们生活的重要场所&#xff0c;传统社区的运营及管理方式已经无法满足人们日益增长的物质和文化生活需要。社区的通讯、安全和社区居民信息的收集、处理及共享等问题都成为阻碍社区服务进一步发展的瓶颈。 智慧社区是利用物联网、云计算、移动互联网、信息智能终端等新…

前后端分离项目,vue+uni-app+php+mysql订座预约系统设计与实现(H5移动项目)

功能介绍 【后台功能】 广告管理&#xff1a;设置小程序首页轮播图广告和链接 留言列表&#xff1a;所有用户留言信息列表&#xff0c;支持删除 会员列表&#xff1a;查看所有注册会员信息&#xff0c;支持删除 录入资讯&#xff1a;录入资讯标题、内容等信息 管理资讯&#x…

电力电子元器件行业研究:市场规模持续增长

电力电子元器件制造是指用于电能变换和控制&#xff08;从而实现运动控制&#xff09;的电子产品的制造。 电力电子器件具有以下特征 1&#xff09;其处理电功率的能力较强&#xff1b;&#xff08;2&#xff09;其主要工作在开关状态&#xff1b;&#xff08;3&#xff09;电…

前后端分离项目,vue+uni-app+php+mysql电影院售票系统设计与实现(H5移动项目)

功能介绍 【后台功能】 会员列表&#xff1a;查看所有注册会员信息&#xff0c;支持删除 录入资讯&#xff1a;录入资讯标题、内容等信息 管理资讯&#xff1a;查看已录入资讯列表&#xff0c;支持删除和修改 广告设置&#xff1a;上传图片和设置小程序首页轮播图广告地址 留言…

Java项目:JSP网上在线酒类商城系统网站

作者主页&#xff1a;源码空间站2022 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文末获取源码 项目介绍 本项目为前后台项目&#xff0c;分为普通用户与管理员两种角色&#xff0c;普通用户登录前台&#xff0c;管理员登录后台&#xff1b; 管理员角…

[附源码]java毕业设计医院疫情疾控管理系统

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

Android入门第34天-Android的Menu组件使用大全

简介 Android有不同的菜单&#xff1a; 系统菜单弹出菜单&#xff08;可自定义样式&#xff09;Context Menu&#xff1b;子菜单&#xff1b; 菜单的使用和我们前面说的AlertDialog很像。它可以支持自定义样式、也可以对菜单的点击事件进行绑定。 Android里有几个MainActivit…

《嵌入式 - 深入剖析STM32》STM32 启动流程详解(GCC)

开发环境&#xff1a; 处理器&#xff1a;STM32F103 GCC&#xff1a;10.3.1 对于我们常用的桌面操作系统而言&#xff0c;我们在开发应用时&#xff0c;并不关心系统的初始化&#xff0c;绝大多数应用程序是在操作系统运行后才开始运行的&#xff0c;操作系统已经提供了一个合…

vxe-table 表格尾部小计列项再合计展示

公式&#xff1a;店员奖金item1item3item5item7 this.dyjj全局变量 this.tableDat 全局数组 1.求出尾部小计这一行的数据 columns.map((column, columnIndex) > { var aa XEUtils.sum(data, column.property) this.tableDat.push(aa) if (columnIndex 0) { return ‘小计…