软件开发定制定制Java+JSP+Mysql+Tomcat实现Web图书管理系统

软件开发定制定制图书管理系统

一、系统介绍

1.软件环境

IDEA:2018.2
Java:jdk1.8
Mysql:8.0.13
Tomcat:8.5.23

2.软件开发定制定制功能模块图

3.系统功能

1.软件开发定制定制系统的注册、登录、注销
2.软件开发定制定制读者信息管理
软件开发定制定制系统管理员可以对读者软件开发定制定制软件开发定制定制信息进行查询、添加、修改、软件开发定制定制软件开发定制定制删除等操作。
3.软件开发定制定制图书信息管理
软件开发定制定制系统管理员可以对图书信息进行查询、添加、修改、删除等操作。
4.借阅信息管理
管理管理可以对借阅信息进行查询和删除操作,用户可以对借阅信息进行新增、查看操作。
5.个人书架管理
用户对个人书架的新增、删处、查看操作。
6.留言管理
用户可以对留言进行新增、查看操作。

4.数据库表

1.读者表

2.借阅信息表

3.评论留言表

4.图书表

5.书架表

5.工程截图

二、系统展示

1.系统注册

2.系统登录

3.找回密码

4.管理员-主页

5.管理员-用户管理主页

6.管理员-新增用户

7.管理员-修改用户

8.管理员-借阅信息管理

9.管理员-图书管理主页

10.管理员-新增图书

11.管理员-修改图书

12.用户-主页

13.用户-图书明细查看

14.用户-新增留言

15.用户-借阅信息管理

16.用户-书架管理

三、代码实现

Book

package com.sjsq.po;import java.io.Serializable;import java.util.Date;/** * @author shuijianshiqing * @date 2020/5/19 22:40 */public class Book implements Serializable {    private static final long serialVersionUID = 1L;    private Integer bookid;    private String bookname;    private Double price;    private String author;    private String publish;    private Integer categoryid;    private String booklink;    private Date deadline;    public static long getSerialVersionUID() {        return serialVersionUID;    }    public Integer getBookid() {        return bookid;    }    public void setBookid(Integer bookid) {        this.bookid = bookid;    }    public String getBookname() {        return bookname;    }    public void setBookname(String bookname) {        this.bookname = bookname;    }    public Double getPrice() {        return price;    }    public void setPrice(Double price) {        this.price = price;    }    public String getAuthor() {        return author;    }    public void setAuthor(String author) {        this.author = author;    }    public String getPublish() {        return publish;    }    public void setPublish(String publish) {        this.publish = publish;    }    public Integer getCategoryid() {        return categoryid;    }    public void setCategoryid(Integer categoryid) {        this.categoryid = categoryid;    }    public String getBooklink() {        return booklink;    }    public void setBooklink(String booklink) {        this.booklink = booklink;    }    public Date getDeadline() {        return deadline;    }    public void setDeadline(Date deadline) {        this.deadline = deadline;    }    @Override    public String toString() {        return "Book{" +                "bookid=" + bookid +                ", bookname='" + bookname + '\'' +                ", price=" + price +                ", author='" + author + '\'' +                ", publish='" + publish + '\'' +                ", categoryid=" + categoryid +                ", booklink='" + booklink + '\'' +                ", deadline=" + deadline +                '}';    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

User

package com.sjsq.po;import java.io.Serializable;/** * @author shuijianshiqing * @date 2020/5/19 22:19 * 用户的实体类 */public class User implements Serializable {    // 增加序列号,作用是反序列化的时候不会报错,切能进行IO的持久化    public static final long serialVersionUID = 1L;    private Integer userid;    private String username;    private String password;    private String email;    private String phone;    private Integer isadmin;    public static long getSerialVersionUID() {        return serialVersionUID;    }    public Integer getUserid() {        return userid;    }    public void setUserid(Integer userid) {        this.userid = userid;    }    public String getUsername() {        return username;    }    public void setUsername(String username) {        this.username = username;    }    public String getPassword() {        return password;    }    public void setPassword(String password) {        this.password = password;    }    public String getEmail() {        return email;    }    public void setEmail(String email) {        this.email = email;    }    public String getPhone() {        return phone;    }    public void setPhone(String phone) {        this.phone = phone;    }    public Integer getIsadmin() {        return isadmin;    }    public void setIsadmin(Integer isadmin) {        this.isadmin = isadmin;    }    @Override    public String toString() {        return "User{" +                "userid=" + userid +                ", username='" + username + '\'' +                ", password='" + password + '\'' +                ", email='" + email + '\'' +                ", phone='" + phone + '\'' +                ", isadmin=" + isadmin +                '}';    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86

Record

package com.sjsq.po;import java.util.Date;/** * @author shuijianshiqing * @date 2021/5/22 22:05 * 借阅记录实体类 */public class Record {    private Integer borrowid;    private Integer userid;    private Integer bookid;    private String bookname;    private String booklink;    private Date borrowtime;    public Integer getBorrowid() {        return borrowid;    }    public void setBorrowid(Integer borrowid) {        this.borrowid = borrowid;    }    public Integer getUserid() {        return userid;    }    public void setUserid(Integer userid) {        this.userid = userid;    }    public Integer getBookid() {        return bookid;    }    public void setBookid(Integer bookid) {        this.bookid = bookid;    }    public String getBookname() {        return bookname;    }    public void setBookname(String bookname) {        this.bookname = bookname;    }    public String getBooklink() {        return booklink;    }    public void setBooklink(String booklink) {        this.booklink = booklink;    }    public Date getBorrowtime() {        return borrowtime;    }    public void setBorrowtime(Date borrowtime) {        this.borrowtime = borrowtime;    }    @Override    public String toString() {        return "Record{" +                "borrowid=" + borrowid +                ", userid=" + userid +                ", bookid=" + bookid +                ", bookname='" + bookname + '\'' +                ", booklink='" + booklink + '\'' +                ", borrowtime=" + borrowtime +                '}';    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79

Comment

package com.sjsq.po;import java.sql.Time;import java.util.Date;/** * @author shuijianshiqing * @date 2021/5/22 17:18 * * 留言表 */public class Comment {    private Integer commentid;    private Integer userid;    private String username;    private Integer bookid;    private String bookname;    private String comment;    private Date time;    public Integer getCommentid() {        return commentid;    }    public void setCommentid(Integer commentid) {        this.commentid = commentid;    }    public Integer getUserid() {        return userid;    }    public void setUserid(Integer userid) {        this.userid = userid;    }    public String getUsername() {        return username;    }    public void setUsername(String username) {        this.username = username;    }    public Integer getBookid() {        return bookid;    }    public void setBookid(Integer bookid) {        this.bookid = bookid;    }    public String getBookname() {        return bookname;    }    public void setBookname(String bookname) {        this.bookname = bookname;    }    public String getComment() {        return comment;    }    public void setComment(String comment) {        this.comment = comment;    }    public Date getTime() {        return time;    }    public void setTime(Date time) {        this.time = time;    }    @Override    public String toString() {        return "Comment{" +                "commentid=" + commentid +                ", userid=" + userid +                ", username='" + username + '\'' +                ", bookid=" + bookid +                ", bookname='" + bookname + '\'' +                ", comment='" + comment + '\'' +                ", time=" + time +                '}';    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91

BookShelf

package com.sjsq.po;import java.util.Date;/** * @author shuijianshiqing * @date 2021/5/22 12:21 * 书架类 */public class BookShelf {    private Integer id;    private Integer userid;    private Integer bookid;    private String bookname;    private String booklink;    private Date adddate;    private Date removedate;    public Integer getId() {        return id;    }    public void setId(Integer id) {        this.id = id;    }    public Integer getUserid() {        return userid;    }    public void setUserid(Integer userid) {        this.userid = userid;    }    public Integer getBookid() {        return bookid;    }    public void setBookid(Integer bookid) {        this.bookid = bookid;    }    public String getBookname() {        return bookname;    }    public void setBookname(String bookname) {        this.bookname = bookname;    }    public String getBooklink() {        return booklink;    }    public void setBooklink(String booklink) {        this.booklink = booklink;    }    public Date getAdddate() {        return adddate;    }    public void setAdddate(Date adddate) {        this.adddate = adddate;    }    public Date getRemovedate() {        return removedate;    }    public void setRemovedate(Date removedate) {        this.removedate = removedate;    }    @Override    public String toString() {        return "BookShelf{" +                "id=" + id +                ", userid=" + userid +                ", bookid=" + bookid +                ", bookname='" + bookname + '\'' +                ", booklink='" + booklink + '\'' +                ", adddate=" + adddate +                ", removedate=" + removedate +                '}';    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

BookDao

package com.sjsq.dao;import com.sjsq.po.Book;import java.util.List;/** * @author shuijianshiqing * @date 2020/5/20 23:13 * 图书信息接口 */public interface BookDao {    /**     * 查询图书信息     * @param sql     * @param arr     * @return     */    public List<Book> select(String sql, Object[] arr);    /**     * 根据图书编号进行查询     * @param bookid     * @return     */    public Book getBook(Integer bookid);    /**     * 图书新增     * @param book     * @return     */    public boolean addBook(Book book);    /**     * 图书修改     * @param book     * @return     */    public boolean updateBook(Book book);    /**     * 删除图书     * @param bookid     * @return     */    public boolean deleteBook(Integer bookid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52

BookShelfDao

package com.sjsq.dao;import com.sjsq.po.BookShelf;import java.util.List;/** * @author shuijianshiqing * @date 2021/5/22 12:23 */public interface BookShelfDao {    /**     * 按照用户名检索书架     * @param userid     * @return     */    public List<BookShelf> selectBookShelf(Integer userid);    /**     * 加入书架     * @param bookShelf     * @return     */    public boolean addBookShelf(BookShelf bookShelf);    /**     * 移出书架     * @param userid     * @param bookid     * @return     */    public boolean removeBookShelf(Integer userid,Integer bookid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38

CommentDao

package com.sjsq.dao;import com.sjsq.po.Comment;import java.util.List;/** * @author shuijianshiqing * @date 2021/5/22 17:21 */public interface CommentDao {    /**     * 添加留言     * @param comment     * @return     */    public boolean addComment(Comment comment);    /**     * 展示留言     * @param bookid     * @return     */    public List<Comment> selectComment(Integer bookid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

RecordDao

package com.sjsq.dao;import com.sjsq.po.Record;import java.util.List;/** * @author shuijianshiqing * @date 2021/5/22 22:07 */public interface RecordDao {    /**     * 查询所有借阅信息     * @return     */    public List<Record> selectRecords();    /**     * 查询借阅信息     * @return     */    public List<Record> selectRecord(Integer userid);    /**     * 新增借阅记录     * @param record     * @return     */    public boolean addRecord(Record record);    /**     * 删除借阅记录     * @param borrowid     * @return     */    public boolean deleteRecord(Integer borrowid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41

UserDao

package com.sjsq.dao;import com.sjsq.po.User;import java.util.List;/** * @author shuijianshiqing * @date 2020/5/20 22:10 * 创建一个接口用于声明用户登录注册的方法 */public interface UserDao {    /**     * 用户登录     * @param user     * @return     */    public User login(User user);    /**     * 用户注册     * @param user     * @return     */    public boolean register(User user);    /**     * 查询用户信息     * @param sql     * @param arr     * @return     */    public List<User> selectUser(String sql, Object arr[]);    /**     * 根据用户编号进行查询     * @param userid     * @return     */    public User getUser(Integer userid);    /**     * 新增用户     * @param user     * @return     */    public boolean addUser(User user);    /**     * 修改用户     * @param user     * @return     */    public boolean updateUser(User user);    /**     * 删除用户     * @param userid     * @return     */    public boolean deleteUser(Integer userid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68

BookService

package com.sjsq.service;import com.sjsq.po.Book;import java.util.List;/** * @author shuijianshiqing * @date 2020/5/20 23:37 * Book的Service层 */public interface BookService {    /**     * 查询图书信息     * @param bookname     * @return     */    public List<Book> select(String bookname);    /**     * 根据图书编号进行查询     * @param id     * @return     */    public Book getBook(Integer id);    /**     * 图书新增     * @param book     * @return     */    public boolean addBook(Book book);    /**     * 图书修改     * @param book     * @return     */    public boolean updateBook(Book book);    /**     * 删除图书     * @param bookid     * @return     */    public boolean deleteBook(Integer bookid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50

BookShelfService

package com.sjsq.service;import com.sjsq.po.BookShelf;import java.util.List;/** * @author shuijianshiqing * @date 2021/5/22 12:36 */public interface BookShelfService {    /**     * 按照用户名检索书架     * @param userid     * @return     */    public List<BookShelf> selectBookShelf(Integer userid);    /**     * 加入书架     * @param bookShelf     * @return     */    public boolean addBookShelf(BookShelf bookShelf);    /**     * 移出书架     * @param userid     * @param bookid     * @return     */    public boolean removeBookShelf(Integer userid,Integer bookid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

CommentService

package com.sjsq.service;import com.sjsq.po.Comment;import java.util.List;/** * @author shuijianshiqing * @date 2021/5/22 17:21 */public interface CommentService {    /**     * 添加留言     * @param comment     * @return     */    public boolean addComment(Comment comment);    /**     * 展示留言     * @param bookid     * @return     */    public List<Comment> selectComment(Integer bookid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

RecordService

package com.sjsq.service;import com.sjsq.po.Record;import java.util.List;/** * @author shuijianshiqing * @date 2021/5/22 22:17 */public interface RecordService {    /**     * 查询所有借阅信息     * @return     */    public List<Record> selectRecords();    /**     * 查询借阅信息     * @return     */    public List<Record> selectRecord(Integer userid);    /**     * 新增借阅记录     * @param record     * @return     */    public boolean addRecord(Record record);    /**     * 删除借阅记录     * @param borrowid     * @return     */    public boolean deleteRecord(Integer borrowid);}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41

login.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>    <%        // 获取绝对路径路径 ,开发项目一定要使用绝对路径,不然肯定出错        String path = request.getContextPath();        String basePath = request.getScheme() + "://" + request.getServerName() + ":"                + request.getServerPort() + path + "/";    %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>    <base href="<%=basePath %>" />    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>用户登录</title>    <style type="text/css">        h1{            text-align: center;        }        h4{            text-align: center;color: red;        }        body{            background-color: antiquewhite;        }        a{            text-decoration: none;font-size: 20px;color: black;        }        a:hover{            text-decoration: underline;font-size: 24px;color: red;        }    </style></head><body>    <form action="login-do-info.jsp" method="post">        <h1>用户登录</h1>        <hr/>        <table align="center">            <tr>                <td>账号:</td>                <td><input type="text" name="username" id="username" placeholder="请输入您的账号" autofocus="autofocus"></td>            </tr>            <tr>                <td>密码:</td>                <td><input type="password" name="password" id="password" placeholder="请输入您的密码"></td>                <td><a href="search-password.jsp">找回密码</a></td>            </tr>            <tr>                <td colspan="1">                </td>                <td>                    <input type="submit" value="登录"/>                    <input type="reset" value="重置"/>                    <a href="register.jsp" target="_blank">注册</a>                </td>            </tr>        </table>    </form></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59

login-do-info.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%@ page import="com.sjsq.dao.UserDao" %><%@ page import="com.sjsq.dao.impl.UserDaoImpl" %><%@ page import="com.sjsq.po.User" %><%@ page import="com.sjsq.service.UserService" %><%@ page import="com.sjsq.service.impl.UserServiceImpl" %><%@ page import="java.util.List" %><%    // 获取绝对路径路径 ,开发项目一定要使用绝对路径,不然肯定出错    String path = request.getContextPath();    String basePath = request.getScheme() + "://" + request.getServerName() + ":"            + request.getServerPort() + path + "/";%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>    <base href="<%=basePath %>"/>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>用户登录</title>    <style type="text/css">        h1 {            text-align: center;        }        h4 {            text-align: center;            color: red;        }        body {            background-color: antiquewhite;        }    </style></head><body><h1>现存图书列表</h1><hr><%    // 设置接收的编码为UTF-8    request.setCharacterEncoding("utf-8");    User user = new User();    UserDao dao = new UserDaoImpl();    String username = request.getParameter("username");    String password = request.getParameter("password");    user.setUsername(username);    user.setPassword(password);    // 获取用户登录信息    User us = dao.login(user);    // 把数据库里面的User获取出来    UserService service = new UserServiceImpl();    List<User> list = service.selectUser(username);    for (int i = 0; i < list.size(); i++) {        user = list.get(i);    }    System.out.println("----us的信息----");    System.out.println(us);    // 设置会话    session.setAttribute("user", user);    // 这里要对us判空处理,1是管理者,0是学生,此处的isadmin必须填写不能为空。    if (us != null && us.getIsadmin().equals(1)) {        response.sendRedirect("admin-home.jsp");    } else if (us != null && !us.getIsadmin().equals(1)) {        response.sendRedirect("user-home.jsp");    } else {        response.sendRedirect("login-fail.jsp");    }%></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78

login-fail.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>登录失败</title>    <style type="text/css">        h1{            text-align: center;        }        h4{            text-align: center;color: red;        }        body{            background-color: antiquewhite;        }        div{            text-align: center;        }    </style></head><body>    <h1>登录失败</h1>    <hr>    <div>        <a href="login.jsp">返回登录</a>    </div></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

logout.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>退出登录</title></head><body>    <%        // 杀掉会话        session.invalidate();        // 重定向,地址栏的链接会发生改变        response.sendRedirect("login.jsp");    %></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

register.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>用户注册</title>    <style type="text/css">        h1{            text-align: center;        }        h4{            text-align: center;color: red;        }        body{            background-color: antiquewhite;        }        div{            text-align: center;        }    </style></head><body>    <h1>用户注册</h1>    <hr/>    <form action="register-do.jsp" method="post" name="registerForm">        <div>            <tr>                <label>您的账号:</label>                <input type="text" name="name" id="name" placeholder="请输入用户名">            </tr>        </div>        <div>            <tr>                <label>您的密码:</label>                <input type="password" name="password" id="password" placeholder="请输入密码">            </tr>        </div>        <div>            <tr>                <label>确认密码:</label>                <input type="password" name="relpassword" id="relpassword" placeholder="请确认密码">            </tr>        </div>        <div>            <tr>                <label>电话号码:</label>                <input type="text" name="phone" id="phone" placeholder="请输入电话号码">            </tr>        </div>        <div>            <tr>                <label>电子邮件:</label>                <input type="text" name="email" id="email" placeholder="请输入电子邮件">            </tr>        </div>        <div>            <tr>                <button type="submit" onclick="return checkForm()">注册</button>                <button type="reset">重置</button>                <a href="login.jsp" target="_blank">登录</a>            </tr>        </div>    </form>    <script type="text/javascript">        function checkForm() {            var name = registerForm.name.value;            var pwd = registerForm.password.value;            var repwd = registerForm.relpassword.value;            //alert(name + pwd + repwd);            if (name == "" || name == null) {                alert("请输入用户名");                registerForm.name.focus();                return false;            } else if (pwd == "" || pwd == null) {                alert("请输入密码");                registerForm.password.focus();                return false;            } else if (repwd == "" || repwd == null) {                alert("请输入确认密码");                registerForm.relpassword.focus();                return false;            } else if (pwd != repwd) {                alert("两次密码输入不一致,请重新输入!");                registerForm.relpassword.focus();                return false;            }            alert('注册成功!');            return true;        }    </script></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95

register-do.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%><%@page import="com.sjsq.dao.impl.UserDaoImpl"%><%@page import="com.sjsq.dao.UserDao"%><%@page import="com.sjsq.po.User"%><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>处理注册</title></head><body>    <%        // 设置获取注册时的编码为UTF-8        request.setCharacterEncoding("UTF-8");        User user=new User();        //获取register.jsp页面提交的账号和密码        String name=request.getParameter("name");        String password=request.getParameter("password");        String email=request.getParameter("email");        String phone=request.getParameter("phone");        //获取register.jsp页面提交的账号和密码设置到实体类User中        user.setUsername(name);        user.setPassword(password);        user.setEmail(email);        user.setPhone(phone);        //引入数据交互层        UserDao dao=new UserDaoImpl();        boolean flag=dao.register(user);        if(flag){            response.sendRedirect("login.jsp");        }else{            response.sendRedirect("register.jsp");        }    %></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

search-password.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%    // 获取绝对路径路径 ,开发项目一定要使用绝对路径,不然肯定出错    String path = request.getContextPath();    String basePath = request.getScheme() + "://" + request.getServerName() + ":"            + request.getServerPort() + path + "/";%><!DOCTYPE html><html><head>    <base href="<%=basePath %>" />    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>找回密码</title>    <style type="text/css">        h1{            text-align: center;        }        div{            text-align: center;        }        body{            background-color:antiquewhite;        }    </style></head><body>    <h1>找回密码</h1>    <hr>    <div>        <a href="javascript: window.history.go(-1)">返回上一级</a>    </div>    <br>    <form action="search-password-do.jsp" method="post">        <table align="center">            <tr>                <td>请输入账号:</td>                <td><input type="text" name="name"/></td>            </tr>            <tr>                <td colspan="1"></td>                <td>                    <input type="submit" value="提交">                    <input type="reset" value="重置">                </td>            </tr>        </table>    </form></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50

search-password-do.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%@page import="java.util.List"%><%@page import="com.sjsq.service.impl.UserServiceImpl"%><%@page import="com.sjsq.po.User"%>    <%        // 获取绝对路径路径 ,开发项目一定要使用绝对路径,不然肯定出错        String path = request.getContextPath();        String basePath = request.getScheme() + "://" + request.getServerName() + ":"                + request.getServerPort() + path + "/";    %><!DOCTYPE html><html><head>    <base href="<%=basePath %>" />    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>处理找回密码</title></head><body>    <%        User user=new User();        //获取searchPassword.jsp页面提交的账号和密码        String name=request.getParameter("name");        user.setUsername(name);        UserServiceImpl service=new UserServiceImpl();        List<User> list=service.selectUser(user);        request.setAttribute("list", list);        for(User u:list){            request.setAttribute("user", u);            out.print(u);        }        if(user!=null){            request.getRequestDispatcher("search-password-info.jsp").forward(request, response);        }    %></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

search-password-info.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%    // 获取绝对路径路径 ,开发项目一定要使用绝对路径,不然肯定出错    String path = request.getContextPath();    String basePath = request.getScheme() + "://" + request.getServerName() + ":"            + request.getServerPort() + path + "/";%><!DOCTYPE html><html><head>    <base href="<%=basePath %>" />    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>弹出信息</title>    <script type="text/javascript">        alert("您的密码是:${user.password}");    </script>    <style type="text/css">        h1{            text-align: center;        }        div{            text-align: center;        }    </style></head><body>    <h1>您的密码是:${user.password}</h1>    <div>        <td><a href="login.jsp">返回登录</a></td>    </div></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

admin-home.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>管理员主页</title>    <style type="text/css">        body {            background-color: antiquewhite;            text-align: center;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><h1>欢迎来到图书管理系统</h1><hr><h4>管理员操作</h4>    <a href="admin-user-manager.jsp">管理用户</a>    <a href="admin-book-manager.jsp">管理图书</a></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

admin-book-add.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>新增图书</title>    <style type="text/css">        h1 {            text-align: center;        }        h4 {            text-align: center;            color: red;        }        body {            background-color: antiquewhite;        }        div {            text-align: center;        }        #before {            text-align: center;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><h1>新增图书</h1><hr><div id="before">    <a href="javascript: window.history.go(-1)">返回上一级</a></div></br><form action="admin-book-do-add.jsp" method="post" name="registerForm">    <div>        <tr>            <label>图书名称:</label>            <input type="text" name="bookname" id="bookname" placeholder="图书名称" autofocus="autofocus">        </tr>    </div>    <div>        <tr>            <label>图书价格:</label></td>            <input type="text" name="price" id="price" placeholder="图书价格(数字)">        </tr>    </div>    <div>        <tr>            <label>图书作者:</label>            <input type="text" name="author" id="author" placeholder="图书作者">        </tr>    </div>    <div>        <tr>            <label>出版公司:</label>            <input type="text" name="publish" id="publish" placeholder="出版公司">        </tr>    </div>    <div>        <tr>            <label>类型编号:</label>            <input type="text" name="categoryid" id="categoryid" placeholder="类型编号">        </tr>    </div>    <div>        <tr>            <label>书籍链接:</label>            <input type="text" name="booklink" id="booklink" placeholder="书籍链接">        </tr>    </div>    <div id="submitbtn">        <tr>            <button type="submit" onclick="return checkForm()">添加</button>            <button type="reset">重置</button>        </tr>    </div></form><script type="text/javascript">    function checkForm() {        var bookname = registerForm.bookname.value;        var price = registerForm.price.value;        if (bookname == "" || bookname == null) {            alert("请输入图书名称");            registerForm.bookname.focus();            return false;        } else if (price == "" || price == null) {            alert("请输入图书价格");            registerForm.price.focus();            return false;        }        alert('添加成功!');        return true;    }</script></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108

admin-book-delete.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%@ page import="com.sjsq.dao.BookDao" %><%@ page import="com.sjsq.dao.impl.BookDaoImpl" %><%@ page import="com.sjsq.po.Book" %><%@ page import="com.sjsq.service.BookService" %><%@ page import="com.sjsq.service.impl.BookServiceImpl" %><html><head>    <title>删除图书</title>    <style type="text/css">        #before {            text-align: center;        }        body {            background-color: antiquewhite;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><%    // 设置获取注册时的编码为UTF-8    request.setCharacterEncoding("UTF-8");    //获取admin.jsp页面的bookid    Integer bookid = Integer.parseInt(request.getParameter("bookid"));    //引入数据交互层    BookService bookService = new BookServiceImpl();    Book book = new Book();    book = bookService.getBook(bookid);    System.out.println("删除的图书信息:");    System.out.println(book);    boolean flag = bookService.deleteBook(bookid);    if (flag) {        response.sendRedirect("admin-book-manager.jsp");    } else {        response.sendRedirect("error.jsp");    }%></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51

admin-book-update.jsp

<%@ page import="com.sjsq.dao.BookDao" %><%@ page import="com.sjsq.dao.impl.BookDaoImpl" %><%@ page import="com.sjsq.po.Book" %><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>修改图书</title>    <style type="text/css">        h1 {            text-align: center;        }        h4 {            text-align: center;            color: red;        }        body {            background-color: antiquewhite;        }        div {            text-align: center;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><h1>修改图书</h1><hr/><%    //获取admin-home.jsp页面的bookid    Integer bookid = Integer.parseInt(request.getParameter("bookid"));    BookDao dao = new BookDaoImpl();    Book book = new Book();    book = dao.getBook(bookid);%><form action="admin-book-do-update.jsp" method="post" name="registerForm">    <div>        <tr>            <input type="hidden" name="bookid" id="bookid" value="<%=book.getBookid()%>">        </tr>    </div>    <div>        <tr>            <label>图书名称:</label>            <input type="text" name="bookname" id="bookname" value="<%=book.getBookname()%>" autofocus="autofocus">        </tr>    </div>    <div>        <tr>            <label>图书价格:</label></td>            <input type="text" name="price" id="price" value="<%=book.getPrice()%>">        </tr>    </div>    <div>        <tr>            <label>图书作者:</label>            <input type="text" name="author" id="author" value="<%=book.getAuthor()%>">        </tr>    </div>    <div>        <tr>            <label>出版公司:</label>            <input type="text" name="publish" id="publish" value="<%=book.getPublish()%>">        </tr>    </div>    <div>        <tr>            <label>类型编号:</label>            <input type="text" name="categoryid" id="categoryid" value="<%=book.getCategoryid()%>">        </tr>    </div>    <div>        <tr>            <label>书籍链接:</label>            <input type="text" name="booklink" id="booklink" value="<%=book.getBooklink()%>">        </tr>    </div>    <div>        <tr>            <button type="submit" onclick="return checkForm()">修改</button>            <button type="reset">重置</button>        </tr>    </div></form><script type="text/javascript">    function checkForm() {        var bookname = registerForm.bookname.value;        var price = registerForm.price.value;        //alert(name + pwd + repwd);        if (bookname == "" || bookname == null) {            alert("请输入图书名称");            registerForm.bookname.focus();            return false;        } else if (price == "" || price == null) {            alert("请输入图书价格");            registerForm.price.focus();            return false;        }        alert('修改成功!');        return true;    }</script></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114

admin-user-add.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>新增用户</title>    <style type="text/css">        h1 {            text-align: center;        }        h4 {            text-align: center;            color: red;        }        body {            background-color: antiquewhite;        }        div {            text-align: center;        }        #before {            text-align: center;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><h1>新增用户</h1><hr><div id="before">    <a href="javascript: window.history.go(-1)">返回上一级</a></div></br><form action="admin-user-do-add.jsp" method="post" name="registerForm">    <div>        <tr>            <label>账号:</label>            <input type="text" name="username" id="username" placeholder="用户名" autofocus="autofocus">        </tr>    </div>    <div>        <tr>            <label>密码:</label></td>            <input type="text" name="password" id="password" placeholder="密码">        </tr>    </div>    <div>        <tr>            <label>邮箱:</label>            <input type="text" name="email" id="email" placeholder="邮箱">        </tr>    </div>    <div>        <tr>            <label>电话:</label>            <input type="text" name="phone" id="phone" placeholder="电话">        </tr>    </div>    <div>        <tr>            <label>是否管理员:</label>            <input type="text" name="isadmin" id="isadmin" placeholder="是否管理员(1是,0否)">        </tr>    </div>    <div id="submitbtn">        <tr>            <button type="submit" onclick="return checkForm()">添加</button>            <button type="reset">重置</button>        </tr>    </div></form><script type="text/javascript">    function checkForm() {        var username = registerForm.username.value;        var password = registerForm.password.value;        if (username == "" || username == null) {            alert("请输入用户名");            registerForm.username.focus();            return false;        } else if (password == "" || password == null) {            alert("请输入密码");            registerForm.password.focus();            return false;        }        alert('添加成功!');        return true;    }</script></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102

admin-user-delete.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%@ page import="com.sjsq.po.User" %><%@ page import="com.sjsq.service.UserService" %><%@ page import="com.sjsq.service.impl.UserServiceImpl" %><html><head>    <title>删除用户</title>    <style type="text/css">        #before {            text-align: center;        }        body {            background-color: antiquewhite;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><%    // 设置获取注册时的编码为UTF-8    request.setCharacterEncoding("UTF-8");    //获取admin-user-manager.jsp页面的userid    Integer userid = Integer.parseInt(request.getParameter("userid"));    //引入数据交互层    UserService userService = new UserServiceImpl();    // 获取删除用户的信息    User user = userService.getUser(userid);    System.out.println("删除的用户信息:"+user);    boolean flag = userService.deleteUser(userid);    if (flag) {        response.sendRedirect("admin-user-manager.jsp");    } else {        response.sendRedirect("error.jsp");    }%></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48

admin-user-update.jsp

<%@ page import="com.sjsq.po.User" %><%@ page import="com.sjsq.service.UserService" %><%@ page import="com.sjsq.service.impl.UserServiceImpl" %><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>修改用户</title>    <style type="text/css">        h1 {            text-align: center;        }        h4 {            text-align: center;            color: red;        }        body {            background-color: antiquewhite;        }        div {            text-align: center;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><h1>修改用户</h1><hr/><%    //获取admin-user-home.jsp页面的userid    Integer userid = Integer.parseInt(request.getParameter("userid"));    UserService userService = new UserServiceImpl();    User user = userService.getUser(userid);%><form action="admin-user-do-update.jsp" method="post" name="registerForm">    <div>        <tr>            <label>编号:</label>            <input type="text" name="userid" id="userid" readonly="readonly" value="<%=user.getUserid()%>">        </tr>    </div>    <div>        <tr>            <label>用户:</label>            <input type="text" name="username" id="username" readonly="readonly" value="<%=user.getUsername()%>">        </tr>    </div>    <div>        <tr>            <label>密码:</label>            <input type="text" name="password" id="password" value="<%=user.getPassword()%>">        </tr>    </div>    <div>        <tr>            <label>邮箱:</label>            <input type="text" name="email" id="email" value="<%=user.getEmail()%>">        </tr>    </div>    <div>        <tr>            <label>电话:</label>            <input type="text" name="phone" id="phone" value="<%=user.getPhone()%>">        </tr>    </div>    <div>        <tr>            <label>是否管理员:</label>            <input type="text" name="isadmin" id="isadmin" value="<%=user.getIsadmin()%>">        </tr>    </div>    <div>        <tr>            <button type="submit" onclick="return checkForm()">修改</button>            <button type="reset">重置</button>        </tr>    </div></form><script type="text/javascript">    function checkForm() {        var password = registerForm.password.value;        if (password == "" || password == null) {            alert("请输入密码");            registerForm.password.focus();            return false;        }        alert('修改成功!');        return true;    }</script></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104

user-home.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%@ page import="com.sjsq.po.Book" %><%@ page import="com.sjsq.service.impl.BookServiceImpl" %><%@ page import="java.util.List" %><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <title>查看图书</title>    <style type="text/css">        h1 {            text-align: center;        }        #before {            text-align: center;        }    </style></head><body><%-- 头部 --%><jsp:include page="user-top.jsp"/><%--图书信息--%><%    // 获取上一个页面传过来的值    String bookname = request.getParameter("bookname");    System.out.println("书名:" + bookname);    // 传入的空字符串处理,null不能使用equals    if (bookname != null && bookname.equals("")) {        bookname = null;    }    BookServiceImpl service = new BookServiceImpl();    List<Book> list = service.select(bookname);%><h1>图书列表</h1><hr><div id="before">    <form action="user-home.jsp" method="post">        请输入书名:<input type="text" name="bookname" placeholder="输入图书名称搜索">        <input type="submit" value="查询"/>    </form>    <a href="javascript: window.history.go(-1)">返回上一级</a></div><br><table align="center" cellspacing="0">    <tr bgcolor="#5f9ea0" style="font-size: 20px;height:40px;text-align: center">        <td style="width: 120px">编号</td>        <td style="width: 120px">书名</td>        <td style="width: 120px">价格</td>        <td style="width: 120px">作者</td>        <td style="width: 120px">出版社</td>    </tr>    <%        String bg = null;        for (int i = 0; i < list.size(); i++) {            Book b = list.get(i);            if (i % 2 == 0) {                bg = "pink";            } else {                bg = "yellow";            }    %>    <tr bgcolor="<%=bg%>" style="height:40px;text-align: center">        <td><%=b.getBookid()%>        </td>        <td><a href="user-book-info.jsp?bookid=<%=b.getBookid()%>"><%=b.getBookname()%>        </a></td>        <td><%=b.getPrice() %>        </td>        <td><%=b.getAuthor() %>        </td>        <td><%=b.getPublish() %>        </td>    </tr>    <%        }    %></table></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

user-comment-add.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %><%@ page import="com.sjsq.po.User" %><%@ page import="com.sjsq.service.BookShelfService" %><%@ page import="com.sjsq.service.impl.BookShelfServiceImpl" %><%@ page import="com.sjsq.po.BookShelf" %><%@ page import="com.sjsq.po.Book" %><%@ page import="com.sjsq.service.BookService" %><%@ page import="com.sjsq.service.impl.BookServiceImpl" %><%@ page import="com.sjsq.service.CommentService" %><%@ page import="com.sjsq.service.impl.CommentServiceImpl" %><%@ page import="com.sjsq.po.Comment" %><html><head>    <title>加入书架</title>    <style type="text/css">        body {            background-color: antiquewhite;        }    </style></head><body><%-- 头部 --%><jsp:include page="top.jsp"/><%    // 设置获取注册时的编码为UTF-8    request.setCharacterEncoding("UTF-8");    // 获取user信息    User user =(User)session.getAttribute("user");    Integer userid = user.getUserid();    String username = user.getUsername();    //获取book信息    Integer bookid = Integer.parseInt(request.getParameter("bookid"));    BookService bookService = new BookServiceImpl();    Book book = bookService.getBook(bookid);    String bookname = book.getBookname();    String content = request.getParameter("content");    Comment comment = new Comment();    comment.setUserid(userid);    comment.setUsername(username);    comment.setBookid(bookid);    comment.setBookname(bookname);    comment.setComment(content);    session.setAttribute("bookid",bookid);    //引入数据交互层    CommentService commentService = new CommentServiceImpl();    boolean flag = commentService.addComment(comment);    if (flag) {        response.sendRedirect("user-book-info.jsp");    } else {        response.sendRedirect("error.jsp");    }%></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70

四、其他

1.其他系统实现

Java+JSP系统系列实现



Java+Servlet+JSP系统系列实现











Java+SSM系统系列实现







Java+SSH系统系列实现


Java+Springboot系统系列实现



JavaSwing+Mysql系统系列实现























JavaSwing+Txt系统系列实现



2.获取源码

点击以下链接获取源码,数据库文件在sql文件下面。

3.功能演示及实现视频

有需要可以关住账号


4.备注

如有侵权请联系我删除。

5.联系博主

左侧关注微信公众号,里面有Java教程和一些Java资源。如果此文对您有帮助,请关注加点赞,谢谢!

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发