作者主页:源码空间站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+jquery+servlet+mysql
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目;
3. 将项目中DBManager.java配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/jsp_jdydxt/ 登录
管理员账号/密码:admin/admin
用户账号/密码: user/123456
运行截图
前台界面
后台界面
相关代码
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
}
}
如果也想学习本系统,下面领取。关注并回复:041jsp