Java最全IDEA+Java+Servlet+JSP+Mysql实现Web图书管理系统【建议收藏(1),技术总监都拍手叫好
创始人
2025-01-15 07:05:44
0

写在最后

作为一名即将求职的程序员,面对一个可能跟近些年非常不同的 2019 年,你的就业机会和风口会出现在哪里?在这种新环境下,工作应该选择大厂还是小公司?已有几年工作经验的老兵,又应该如何保持和提升自身竞争力,转被动为主动?

就目前大环境来看,跳槽成功的难度比往年高很多。一个明显的感受:今年的面试,无论一面还是二面,都很考验Java程序员的技术功底。

最近我整理了一份复习用的面试题及面试高频的考点题及技术点梳理成一份“Java经典面试问题(含答案解析).pdf和一份网上搜集的“Java程序员面试笔试真题库.pdf”(实际上比预期多花了不少精力),包含分布式架构、高可扩展、高性能、高并发、Jvm性能调优、Spring,MyBatis,Nginx源码分析,Redis,ActiveMQ、Mycat、Netty、Kafka、Mysql、Zookeeper、Tomcat、Docker、Dubbo、Nginx等多个知识点高级进阶干货!

由于篇幅有限,为了方便大家观看,这里以图片的形式给大家展示部分的目录和答案截图!

Java经典面试问题(含答案解析)

阿里巴巴技术笔试心得

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

DROP TABLE IF EXISTS iolog;

CREATE TABLE iolog (

bookid varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

readerid varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

service int(11) NULL DEFAULT NULL,

borrowtime varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,

borrowday int(11) NULL DEFAULT NULL,

complete int(11) NULL DEFAULT NULL,

PRIMARY KEY (borrowtime) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;


– Records of iolog


INSERT INTO iolog VALUES (‘000001’, ‘1’, -1, ‘2021年08月21日 21时38分10秒’, 7, 1);

INSERT INTO iolog VALUES (‘000001’, ‘1’, 1, ‘2021年08月21日 21时38分20秒’, NULL, 1);


– Table structure for reader


DROP TABLE IF EXISTS reader;

CREATE TABLE reader (

username varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT ‘读者用户名’,

password varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘读者密码’,

name varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘读者姓名’,

sex varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘读者性别’,

status int(11) NULL DEFAULT NULL COMMENT ‘读者状态(1.正常 -1.黑名单)’,

mail varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘读者邮箱’,

tel varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘读者电话’,

grade int(11) NULL DEFAULT -1 COMMENT ‘读者年级’,

classnum int(11) NULL DEFAULT -1 COMMENT ‘读者班级’,

PRIMARY KEY (username) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = ‘读者表’ ROW_FORMAT = Dynamic;


– Records of reader


INSERT INTO reader VALUES (‘1’, ‘123456’, ‘测试’, ‘测试’, 1, ‘测试’, ‘测试’, 1, 1);


– Table structure for tempadd


DROP TABLE IF EXISTS tempadd;

CREATE TABLE tempadd (

id varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,

bookname varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘书本名称’,

author varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘书本作者’,

publisher varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘出版社’,

price int(11) NULL DEFAULT NULL COMMENT ‘书本价格’,

category varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘书本类目’,

store int(11) NULL DEFAULT NULL,

bookdesc varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

location varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

PRIMARY KEY (id) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;


– Records of tempadd



– Table structure for user


DROP TABLE IF EXISTS user;

CREATE TABLE user (

user varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT ‘用户名’,

password varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘用户密码’,

name varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘用户真实姓名’,

sex varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘用户性别’,

department varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘用户部门’,

tel varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ‘用户电话’,

PRIMARY KEY (user) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;


– Records of user


INSERT INTO user VALUES (‘admin’, ‘admin’, ‘管理员’, ‘男’, ‘图书馆’, ‘12345678901’);

SET FOREIGN_KEY_CHECKS = 1;

5.工程截图


二、系统展示

=======

1.登录系统


2.主页面


3.图书列表


4.图书详情


5.编辑删除


6.添加图书


7.图书借阅


8.图书归还


9.借阅记录


10.用户管理


三、部分代码

=======

BookAction


package Action;

import Dao.BookDao;

import Entity.Book;

import Entity.User;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

import java.io.IOException;

import java.io.PrintWriter;

import java.util.ArrayList;

public class BookAction extends HttpServlet {

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

doGet(request, response);

}

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

request.setCharacterEncoding(“UTF-8”);

response.setCharacterEncoding(“UTF-8”);

String action = request.getParameter(“action”);

if (action.equals(“getall”)) {

this.getAll(request, response);

} else if (action.equals(“addtemp”)) {

this.addtemp(request, response);

} else if (action.equals(“gettemp”)) {

this.gettemp(request, response);

} else if (action.equals(“confirm”)) {

this.confirm(request, response);

} else if (action.equals(“querybookbyid”)) {

this.QueryBookById(request, response);

} else if (action.equals(“DeleteById”)) {

this.DeleteById(request, response);

} else if (action.equals(“EditDone”)) {

this.EditDone(request, response);

}

}

private void getAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

BookDao bdao = new BookDao();

ArrayList bookArrayList = bdao.getAllBook();

HttpSession session = request.getSession();

session.setAttribute(“allbooklist”, bookArrayList);

request.getRequestDispatcher(“/book-list.jsp”).forward(request, response);

}

private void addtemp(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String next = request.getParameter(“over”);

BookDao bdao = new BookDao();

Book book = new Book();

if (!request.getParameter(“bookid”).equals(“”))

book.setId(request.getParameter(“bookid”));

if (!request.getParameter(“bookname”).equals(“”))

book.setName(request.getParameter(“bookname”));

if (!request.getParameter(“bookauthor”).equals(“”))

book.setAuthor(request.getParameter(“bookauthor”));

if (!request.getParameter(“bookpublisher”).equals(“”))

book.setPublisher(request.getParameter(“bookpublisher”));

if (!request.getParameter(“bookcategory”).equals(“”))

book.setCategory(request.getParameter(“bookcategory”));

if (!request.getParameter(“bookprice”).trim().equals(“”))

book.setPrice(Integer.parseInt(request.getParameter(“bookprice”)));

if (!request.getParameter(“bookstore”).trim().equals(“”))

book.setStore(Integer.parseInt(request.getParameter(“bookstore”)));

if (!request.getParameter(“booklocation”).equals(“”))

book.setLocation(request.getParameter(“booklocation”));

if (!request.getParameter(“bookdesc”).equals(“”))

book.setDesc(request.getParameter(“bookdesc”));

if (!request.getParameter(“bookid”).equals(“”))

bdao.addtemp(book);

if (next.equals(“0”))

request.getRequestDispatcher(“/add-book.jsp”).forward(request, response);

else

this.gettemp(request, response);

}

private void gettemp(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

BookDao bdao = new BookDao();

ArrayList addbooklist = bdao.getadd();

HttpSession session = request.getSession();

session.setAttribute(“addbooklist”, addbooklist);

request.getRequestDispatcher(“/add-confirm.jsp”).forward(request, response);

}

private void confirm(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

BookDao bdao = new BookDao();

bdao.confirm();

this.getAll(request, response);

}

private void QueryBookById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

BookDao bdao = new BookDao();

String id = request.getParameter(“id”);

String next = request.getParameter(“next”);

Book book = bdao.QueryBookById(id);

HttpSession session = request.getSession();

session.setAttribute(“resultbook”, book);

PrintWriter out = response.getWriter();

if (next.equals(“check”))

request.getRequestDispatcher(“/detail.jsp”).forward(request, response);

else if (next.equals(“edit”))

request.getRequestDispatcher(“/edit-book.jsp”).forward(request, response);

else if (next.equals(“borrowcheck”)) {

out.write(book.getName() + “||” + book.getAuthor() + “||” + book.getPublisher() + “||” + book.getRemain());

}

}

private void DeleteById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

BookDao bdao = new BookDao();

String id = request.getParameter(“id”);

bdao.DeleteById(id);

this.getAll(request, response);

}

private void EditDone(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

BookDao bdao = new BookDao();

Book book = new Book();

if (!request.getParameter(“id”).equals(“”))

book.setId(request.getParameter(“id”));

if (!request.getParameter(“name”).equals(“”))

book.setName(request.getParameter(“name”));

if (!request.getParameter(“author”).equals(“”))

book.setAuthor(request.getParameter(“author”));

if (!request.getParameter(“publisher”).equals(“”))

book.setPublisher(request.getParameter(“publisher”));

if (!request.getParameter(“category”).equals(“”))

book.setCategory(request.getParameter(“category”));

if (!request.getParameter(“price”).trim().equals(“”))

book.setPrice(Integer.parseInt(request.getParameter(“price”)));

if (!request.getParameter(“store”).trim().equals(“”))

book.setStore(Integer.parseInt(request.getParameter(“store”)));

if (!request.getParameter(“location”).equals(“”))

book.setLocation(request.getParameter(“location”));

if (!request.getParameter(“desc”).equals(“”))

book.setDesc(request.getParameter(“desc”));

if (!request.getParameter(“id”).equals(“”))

bdao.addtemp(book);

bdao.EditDone(book);

request.getRequestDispatcher(“BookAction?action=querybookbyid&id=<%=b.getId()%>&next=check”).forward(request, response);

}

}

IOAction


package Action;

import Dao.IODao;

import Entity.Log;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

import java.io.IOException;

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Date;

public class IOAction extends HttpServlet {

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String action = request.getParameter(“action”);

if (action.equals(“borrow”)) {

this.borrow(request, response);

} else if (action.equals(“getlog”)) {

this.getlog(request, response);

} else if (action.equals(“return”)) {

this.ReturnBook(request, response);

}

}

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

this.doPost(request, response);

}

protected void borrow(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

IODao ioDao = new IODao();

SimpleDateFormat sdf = new SimpleDateFormat(“yyyy年MM月dd日 HH时mm分ss秒”);

Date date = new Date();

String time = sdf.format(date);

String readerid = request.getParameter(“readerid”);

String bookid = request.getParameter(“bookid”);

int borrowday = Integer.parseInt(request.getParameter(“borrowday”));

ioDao.borrow(bookid, readerid, time, borrowday);

this.getlog(request, response);

}

protected void getlog(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

IODao ioDao = new IODao();

ArrayList loglist = ioDao.getLogList();

HttpSession session = request.getSession();

session.setAttribute(“loglist”, loglist);

request.getRequestDispatcher(“/io-log.jsp”).forward(request, response);

}

protected void ReturnBook(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

IODao ioDao = new IODao();

SimpleDateFormat sdf = new SimpleDateFormat(“yyyy年MM月dd日 HH时mm分ss秒”);

Date date = new Date();

String Returntime = sdf.format(date);

String bookid = request.getParameter(“bookid”);

String readerId = request.getParameter(“ReaderId”);

String borrowtime = request.getParameter(“borrowtime”);

ioDao.ReturnBook(bookid, readerId, borrowtime, Returntime);

this.getlog(request, response);

}

}

LoginAction


package Action;

import Dao.UserDao;

import Entity.User;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

import java.io.IOException;

import java.io.PrintWriter;

public class LoginAction extends HttpServlet {

UserDao udao = new UserDao();

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String action = request.getParameter(“action”);

if (action.equals(“login”)) {

this.login(request, response);

} else if (action.equals(“logout”)) {

this.logout(request, response);

}

}

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

doPost(request, response);

}

private void login(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String username = null;

String password = null;

PrintWriter out = response.getWriter();

HttpSession session = request.getSession();

username = request.getParameter(“username”);

password = request.getParameter(“password”);

User user = new User();

user.setUsername(username);

user.setPassword(password);

String result = udao.login(user);

if (result.equals(“true”)) {

session.setAttribute(“adminname”, user.getName());

request.getRequestDispatcher(“/main.jsp”).forward(request, response);

} else {

out.write(result);

}

}

private void logout(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

HttpSession session = request.getSession();

session.setMaxInactiveInterval(1);

response.sendRedirect(“/index.jsp”);

}

}

ReaderAction


package Action;

/**

  • 读者管理

*/

import Dao.IODao;

import Dao.ReaderDao;

import Entity.Log;

import Entity.Reader;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

import java.io.IOException;

import java.io.PrintWriter;

import java.util.ArrayList;

public class ReaderAction extends HttpServlet {

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String action = request.getParameter(“action”);

request.setCharacterEncoding(“UTF-8”);

response.setCharacterEncoding(“UTF-8”);

response.setContentType(“text/html; charset=utf-8”);

if (action.equals(“QueryReaderById”)) {

this.QueryReaderById(request, response);

} else if (action.equals(“GetBorrowListById”)) {

this.GetBorrowListById(request, response);

} else if (action.equals(“GetAllReader”)) {

this.GetAllReader(request, response);

} else if (action.equals(“SetBlackList”)) {

this.SetBlackList(request, response);

}

}

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

doPost(request, response);

}

protected void QueryReaderById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String readerid = request.getParameter(“readerid”);

总结

阿里伤透我心,疯狂复习刷题,终于喜提offer 哈哈~好啦,不闲扯了

image

1、JAVA面试核心知识整理(PDF):包含JVMJAVA集合JAVA多线程并发,JAVA基础,Spring原理微服务,Netty与RPC,网络,日志,ZookeeperKafkaRabbitMQ,Hbase,MongoDB,Cassandra,设计模式负载均衡数据库一致性哈希JAVA算法数据结构,加密算法,分布式缓存,Hadoop,Spark,Storm,YARN,机器学习,云计算共30个章节。

image

2、Redis学习笔记及学习思维脑图

image

3、数据面试必备20题+数据库性能优化的21个最佳实践

image

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

doPost(request, response);

}

protected void QueryReaderById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String readerid = request.getParameter(“readerid”);

总结

阿里伤透我心,疯狂复习刷题,终于喜提offer 哈哈~好啦,不闲扯了

[外链图片转存中…(img-KVUK1pKN-1715304562853)]

1、JAVA面试核心知识整理(PDF):包含JVMJAVA集合JAVA多线程并发,JAVA基础,Spring原理微服务,Netty与RPC,网络,日志,ZookeeperKafkaRabbitMQ,Hbase,MongoDB,Cassandra,设计模式负载均衡数据库一致性哈希JAVA算法数据结构,加密算法,分布式缓存,Hadoop,Spark,Storm,YARN,机器学习,云计算共30个章节。

[外链图片转存中…(img-nI7gg6xJ-1715304562853)]

2、Redis学习笔记及学习思维脑图

[外链图片转存中…(img-bK8rrfGg-1715304562854)]

3、数据面试必备20题+数据库性能优化的21个最佳实践

[外链图片转存中…(img-SYejIB6g-1715304562854)]

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

相关内容

热门资讯

XML Schema 杂项数据... XML Schema 杂项数据类型XML Schema 提供了多种数据类型,用于定义 XML 文档中...
Html5前端基本知识整理与回... 今天我们继续结合发布的Html5基础知识点文档进行复习,希望对大家有所帮助。目录列表无...
数据结构练习 1.快速排序的非递归是通过栈来实现的,则前序与层次可以通过控制入栈的顺序来实现...
AJAX学习笔记上(学习自用) AJAX原生AJAX1.1AJAX简介AJAX全程为Asynchronous JavaScript ...
React 开发报错整理 1、'yield' expression implicitly results in an 'any...
LLaMA 模型 大模型LLaMA详解LLaMa系列模型详解(原理介绍、代码解读)...
LlamaFactory可视化... LlamaFactory 前言LLaMA Factory 是一个用于微调大型语言模型的强大工具,特别...
Ajax从零到实战   💝💝💝欢迎来到我的博客,很高兴能够...
基于泰坦尼克号生还数据进行 S... 基于泰坦尼克号生还数据进行 Spark 分析在这篇博客中,我们将展示如何使用 Apac...
在亚马逊云科技AWS上利用Sa... 项目简介:接下来,小李哥将会每天介绍一个基于亚马逊云科技AWS云计算平台...