首页 前端知识 基于javaweb mysql的jsp servlet图书借阅管理系统(java jsp bootstrap jquery servlet mysql)

基于javaweb mysql的jsp servlet图书借阅管理系统(java jsp bootstrap jquery servlet mysql)

2024-03-11 10:03:00 前端知识 前端哥 121 707 我要收藏

基于javaweb+mysql的jsp+servlet图书借阅管理系统(java+jsp+bootstrap+jquery+servlet+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb的JSP+Servlet图书借阅管理系统(java+jsp+bootstrap+jquery+servlet+mysql)

项目介绍

本项目分为读者、管理员两种角色,登录验证码。 管理员主要功能包括: 图书管理:1)根据图书名称、作者、分类查询图书基本信息 2)添加、修改或删除图书信息

读者管理:1)根据账号、姓名、ID查询读者基本信息 2)添加、修改或删除读者信息

图书分类管理:1)查看图书分类信息,显示分类ID 2)添加、修改或删除图书分类

图书借阅信息:1)展示所有正在借阅的图书信息与读者信息 2)可以实现还书与延期功能

图书归还信息:1)展示所有已归还的图书的信息 2)记录图书出馆时间与归馆时间

管理员管理(需登录):1)仅最高管理员可以访问本页面 2)添加、修改或删除管理员信息

热门推荐:1)展示每一本书的借阅量,包括图书基本信息 2)可以查询书籍借阅量 最佳读者:展示每一位已知读者的借阅量,以及读者的基本信息

读者登录主要功能包括: 图书查询、借阅信息、借阅历史、热门推荐、最佳读者、问题反馈;

环境需要

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项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

技术栈

  1. 后端:Servlet 2. 前端:JSP+bootstrap+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中util/DBUtil.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入http://localhost:8080/books/login.jsp 登录 注:tomcat中配置项目路径必须为/books 管理员用户名密码:101/101.123456 读者用户名密码:1816270150/wyz123456
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String name = request.getParameter("name");
		String email = request.getParameter("email");
		String phone = request.getParameter("phone");
		int lend_num = Integer.parseInt(request.getParameter("lend_num"));
		int max_num = Integer.parseInt(request.getParameter("max_num"));
		int aid = Integer.parseInt(request.getParameter("aid"));
		AdminDao userdao = new AdminDao();
		userdao.updateUser(aid, username, password, name, email, phone, lend_num, max_num);
		response.sendRedirect("/books/admin_user.jsp");
	}

}

/**
 * Servlet implementation class AddUserServlet
 */
@WebServlet("/AddUserServlet")
public class AddUserServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public AddUserServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		// 获取账号和密码
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		if (username.equals("admin") && password.equals("123456")) {
			response.sendRedirect("/books/admin_admin.jsp");
		} else {
			HttpSession session = request.getSession();
			session.setAttribute("state", "密码错误");
			response.sendRedirect("/books/admin_login.jsp");
		}
	}

}

/**
 * Servlet implementation class updateBookTypeServlet
 */
@WebServlet("/updateBookTypeServlet")
public class updateBookTypeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public updateBookTypeServlet() {
		super();
		// TODO Auto-generated constructor stub
 * Servlet implementation class RegisterServlet
 */
@WebServlet("/RegisterServlet")
public class RegisterServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public RegisterServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		doGet(request, response);
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		// 获取注册信息
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String name = request.getParameter("name");
		String email = request.getParameter("email");
		String phone = request.getParameter("phone");
		int lend_num = 30;
		int max_num = 5;
		AdminDao userdao = new AdminDao();
		// 将注册信息存入数据库,再返回登录
		userdao.Register(username, password, name, email, phone, lend_num, max_num);
		response.sendRedirect("/books/login.jsp");

	}

}
			// 随机获取干扰线的起点和终点
			int xstart = (int) (Math.random() * 80);
			int ystart = (int) (Math.random() * 25);
			int xend = (int) (Math.random() * 80);
			int yend = (int) (Math.random() * 25);
			g.setColor(interLine(1, 255));
			g.drawLine(xstart, ystart, xend, yend);
		}
		HttpSession session = request.getSession(); // 保存到session
		session.setAttribute("code", sb.toString());
		ImageIO.write(bfi, "JPG", response.getOutputStream()); // 写到输出流
	}

	private static Color interLine(int Low, int High) {
		if (Low > 255)
			Low = 255;
		if (High > 255)
			High = 255;
		if (Low < 0)
			Low = 0;
		if (High < 0)
			High = 0;
		int interval = High - Low;
		int r = Low + (int) (Math.random() * interval);
		int g = Low + (int) (Math.random() * interval);
		int b = Low + (int) (Math.random() * interval);
		return new Color(r, g, b);
	}
}

/**

/**
 * Servlet implementation class AdminServlet
 */
@WebServlet("/AdminServlet")
public class AdminServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public AdminServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out = response.getWriter();
		// 设置编码类型

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		doGet(request, response);
		// 设置编码类型
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		HttpSession session = request.getSession();
		AdminBean adminbean = new AdminBean();
		// 获取存到session的aid
		String aid = (String) session.getAttribute("aid");
		AdminDao admindao = new AdminDao();
		// 通过aid获取到读者的信息
		adminbean = admindao.get_AidInfo2(aid);
		// 获取反馈问题的信息
		String name = request.getParameter("name");
		String page = request.getParameter("page");
		String body = request.getParameter("body");
		String phone = request.getParameter("phone");
		ProblemDao problemdao = new ProblemDao();
		// 调用函数存入反馈信息
		problemdao.addProblem(adminbean, name, page, body, phone);
		response.sendRedirect("/books/result.jsp");
	}

}


/**
 * Servlet implementation class bdtimesServlet
 */
@WebServlet("/brtimesServlet")
public class brtimesServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public brtimesServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
//		doGet(request, response);
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		// 因为在管理员界面和读者界面都有查找功能,为了将查找的结果返回正确的页面,设置了tip,tip=1表示管理员界面
		int tip = Integer.parseInt(request.getParameter("tip"));
		String name = request.getParameter("name");
			 * 还书在管理员和读者界面都有,为了区分,设置了show字段,show为1表示读者界面
			 */
			int show = Integer.parseInt(request.getParameter("show"));
			// 调用还书函数,改变status字段
			bookdao.borrowBook2(hid);
			if (show == 1) {
				response.sendRedirect("/books/borrow.jsp");
			} else {
				response.sendRedirect("/books/admin_borrow.jsp");
			}

		}

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

/**
 * Servlet implementation class LoginServlet
 */
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");

		BufferedImage bfi = new BufferedImage(80, 25, BufferedImage.TYPE_INT_RGB);
		Graphics g = bfi.getGraphics();
		g.fillRect(0, 0, 80, 25);

		// 验证码字符范围
		//char[] ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".toCharArray();
		char[] ch = "0123456789".toCharArray();
		Random r = new Random();
		int index;
		StringBuffer sb = new StringBuffer(); // 保存字符串
		for (int i = 0; i < 4; i++) {
			index = r.nextInt(ch.length);
			g.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));
			Font font = new Font("宋体", 30, 20);
			g.setFont(font);
			g.drawString(ch[index] + "", (i * 20) + 2, 23);
			sb.append(ch[index]);
		}

		// 设置验证码中的干扰线
		for (int i = 0; i < 6; i++) {
			// 随机获取干扰线的起点和终点
			int xstart = (int) (Math.random() * 80);
			int ystart = (int) (Math.random() * 25);
			int xend = (int) (Math.random() * 80);
			int yend = (int) (Math.random() * 25);
			g.setColor(interLine(1, 255));
			g.drawLine(xstart, ystart, xend, yend);
		}
		HttpSession session = request.getSession(); // 保存到session
		session.setAttribute("code", sb.toString());
		ImageIO.write(bfi, "JPG", response.getOutputStream()); // 写到输出流
	}
		String password = request.getParameter("password");
		String name = request.getParameter("name");
		String email = request.getParameter("email");
		String phone = request.getParameter("phone");

		AdminDao userdao = new AdminDao();
		// 调用函数添加读者信息
		userdao.Register2(username, password, name, email, phone);
		response.sendRedirect("/books/admin_admin.jsp");
	}

}

/**
 * Servlet implementation class selectServlet
 */
@WebServlet("/selectProblemServlet")
public class selectProblemServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public selectProblemServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		// 获取要添加图书的信息
		String card = request.getParameter("card");
		String name = request.getParameter("name");
		String type = request.getParameter("type");
		String autho = request.getParameter("autho");
		String press = request.getParameter("press");
		int num = Integer.parseInt(request.getParameter("num"));
		BookDao bookdao = new BookDao();
		// 调用函数,存入图书
		bookdao.addBook(card, name, type, autho, press, num);
		response.sendRedirect("/books/admin_book.jsp");
	}

}

/**
 * Servlet implementation class updateUserServlet
 */
@WebServlet("/updateAdminServlet")
public class updateAdminServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public updateAdminServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	 */
	public AdminServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out = response.getWriter();
		// 设置编码类型
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		// 这里为了简单,设置了tip,用来区分是修改密码功能,还是修改个人资料的功能,tip=1为修改密码
		int tip = Integer.parseInt(request.getParameter("tip"));
		// 获取发起请求页面的文件名称,这个在对应的jsp里面的表单填写,修改完成后就可以直接返回对应的页面
		String url = request.getParameter("url");
		HttpSession session = request.getSession();
		AdminBean adminbean = new AdminBean();
		// 获取存到session的aid
		String aid = (String) session.getAttribute("aid");
		AdminDao admindao = new AdminDao();
		// 通过aid获取到读者的信息
		adminbean = admindao.get_AidInfo2(aid);
		// 修改密码
		if (tip == 1) {
			// 获取到输入的旧密码,新密码
			String password = request.getParameter("password");
			String password2 = request.getParameter("password2");
			// 获取读者数据表中的密码
			String old_password = adminbean.getPassword();
			// 对旧密码进行比较,如果相同就修改,不相同就直接退出
			if (old_password.equals(password)) {
				admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), password2, adminbean.getName(),
						adminbean.getEmail(), adminbean.getPhone(), adminbean.getLend_num(), adminbean.getMax_num());
				response.sendRedirect("/books/" + url + ".jsp");
			} else {
				out.write("<script type='text/javascript'>alert('password error');location.href='" + url
						+ ".jsp';  </script>");
			}
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		doGet(request, response);
		// 设置编码类型
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		// 获取要添加的读者的信息
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String name = request.getParameter("name");
		String email = request.getParameter("email");
		String phone = request.getParameter("phone");
		int lend_num = Integer.parseInt(request.getParameter("lend_num"));
		int max_num = Integer.parseInt(request.getParameter("max_num"));

		AdminDao userdao = new AdminDao();
		// 调用函数添加读者信息
		userdao.Register(username, password, name, email, phone, lend_num, max_num);
		response.sendRedirect("/books/admin_user.jsp");
	}

}

/**
		// response.getWriter().append("Served at: ").append(request.getContextPath());
		// 设置编码类型
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		BookDao bookdao = new BookDao();
		// 为了区分借书和还书的功能,设置tip,tip为1,表示借书
		int tip = Integer.parseInt(request.getParameter("tip"));
		if (tip == 1) {
			// 获取图书id
			int bid = Integer.parseInt(request.getParameter("bid"));
			int show = Integer.parseInt(request.getParameter("show"));
			HttpSession session = request.getSession();
			AdminBean admin = new AdminBean();
			// 获取到存入session的aid读者id
			String aid = (String) session.getAttribute("aid");
			AdminDao admindao = new AdminDao();
			// 通过aid获取到读者的信息
			admin = admindao.get_AidInfo2(aid);
			// 将借阅记录存入数据表
			bookdao.borrowBook(bid, admin);
			if (show == 1) {
				response.sendRedirect("/books/select.jsp");
			} else {
				response.sendRedirect("/books/bdtimes.jsp");
			}
		} else {
			// 还书功能,获取借阅记录的hid
			int hid = Integer.parseInt(request.getParameter("hid"));
			/**
			 * 还书在管理员和读者界面都有,为了区分,设置了show字段,show为1表示读者界面
			 */
			int show = Integer.parseInt(request.getParameter("show"));
			// 调用还书函数,改变status字段
			bookdao.borrowBook2(hid);
			if (show == 1) {
				response.sendRedirect("/books/borrow.jsp");
			} else {
				response.sendRedirect("/books/admin_borrow.jsp");
			}

		}

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out = response.getWriter();
		// 设置编码类型
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		// 这里为了简单,设置了tip,用来区分是修改密码功能,还是修改个人资料的功能,tip=1为修改密码
		int tip = Integer.parseInt(request.getParameter("tip"));
		// 获取发起请求页面的文件名称,这个在对应的jsp里面的表单填写,修改完成后就可以直接返回对应的页面
		String url = request.getParameter("url");
		HttpSession session = request.getSession();
		AdminBean adminbean = new AdminBean();
		// 获取存到session的aid
		String aid = (String) session.getAttribute("aid");
		AdminDao admindao = new AdminDao();
		// 通过aid获取到读者的信息
		adminbean = admindao.get_AidInfo2(aid);
		// 修改密码
		if (tip == 1) {
			// 获取到输入的旧密码,新密码
			String password = request.getParameter("password");
			String password2 = request.getParameter("password2");
			// 获取读者数据表中的密码
			String old_password = adminbean.getPassword();
			// 对旧密码进行比较,如果相同就修改,不相同就直接退出
			if (old_password.equals(password)) {
				admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), password2, adminbean.getName(),
						adminbean.getEmail(), adminbean.getPhone(), adminbean.getLend_num(), adminbean.getMax_num());
				response.sendRedirect("/books/" + url + ".jsp");
			} else {
				out.write("<script type='text/javascript'>alert('password error');location.href='" + url
						+ ".jsp';  </script>");
			}
		} else {
			// 修改个人资料
			// 获取输入的信息

/**
 * Servlet implementation class selectServlet
 */
@WebServlet("/selectProblemServlet")
public class selectProblemServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public selectProblemServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		doGet(request, response);
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		String name = request.getParameter("name");
		ProblemDao problemdao = new ProblemDao();
		ArrayList<ProblemBean> data = problemdao.getLikeList(name);
		// 将获取的结果存入请求中
		request.setAttribute("data", data);
		String url = "";
		// 转发界面
			}
		} else {
			session.setAttribute("state", "验证码错误");
			response.sendRedirect("/books/login.jsp");
		}
	}

}

/**
 * Servlet implementation class feedbackServlet
 */
@WebServlet("/AddProblemServlet")
public class AddProblemServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public AddProblemServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

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

转载请注明出处或者链接地址:https://www.qianduange.cn//article/3628.html
标签
mysqlservlet
评论
会员中心 联系我 留言建议 回顶部
复制成功!