├── .idea ├── artifacts │ └── OnlineBooks_war_exploded.xml ├── dataSources.xml ├── libraries │ └── javax_servlet_jsp_jstl.xml ├── misc.xml ├── modules.xml ├── uiDesigner.xml └── vcs.xml ├── OnlineBooks.iml ├── README.md ├── src └── cn │ └── ylcto │ ├── book │ ├── DAO │ │ ├── IAdminDAO.java │ │ ├── IBooksDAO.java │ │ ├── IDAO.java │ │ ├── IItemDAO.java │ │ ├── ILenbookDAO.java │ │ ├── IMemberDao.java │ │ └── impl │ │ │ ├── AdminDAOImpl.java │ │ │ ├── BooksDAOImpl.java │ │ │ ├── ItemDAOImpl.java │ │ │ ├── LenbookDAOimpl.java │ │ │ └── MemberDaoImpl.java │ ├── dbc │ │ └── DatabaseConnection.java │ ├── factory │ │ ├── DAOFactory.java │ │ └── ServiceFactory.java │ ├── filter │ │ └── AdminLoginFilter.java │ ├── service │ │ ├── IAdminService.java │ │ ├── IBooksService.java │ │ ├── IItemService.java │ │ ├── ILenbookService.java │ │ ├── IMemberService.java │ │ └── impl │ │ │ ├── AdminServiceImpl.java │ │ │ ├── BooksServiceImpl.java │ │ │ ├── ItemServiceImpl.java │ │ │ ├── LenbookServiceImpl.java │ │ │ └── MemberServiceImpl.java │ ├── servlet │ │ ├── AdminServlet.java │ │ ├── BooksServlet.java │ │ ├── ItemServlet.java │ │ ├── LenbookServlet.java │ │ ├── MemberServlet.java │ │ └── template.java │ └── vo │ │ ├── Admin.java │ │ ├── Books.java │ │ ├── Item.java │ │ ├── Lenbook.java │ │ └── Member.java │ └── util │ ├── MD5Code.java │ ├── filter │ └── EncodingFilter.java │ ├── test │ └── AbstractDAOImpl.java │ └── validate │ └── ValidateUtils.java ├── web ├── WEB-INF │ ├── c.tld │ └── web.xml ├── YF.png ├── assets │ ├── css │ │ ├── basic.css │ │ ├── bootstrap.css │ │ ├── custom.css │ │ └── font-awesome.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ ├── img │ │ └── user.png │ └── js │ │ ├── bootstrap.js │ │ ├── custom.js │ │ ├── jquery-1.10.2.js │ │ └── jquery.metisMenu.js ├── index.jsp ├── kong.jsp ├── login.jsp ├── pages │ ├── back │ │ ├── books │ │ │ ├── books_insert.jsp │ │ │ └── books_list.jsp │ │ ├── footer.jsp │ │ ├── header.jsp │ │ ├── lenbook │ │ │ └── lenbook_insert.jsp │ │ └── member │ │ │ ├── item_insert.jsp │ │ │ ├── item_list.jsp │ │ │ └── member_insert.jsp │ ├── forward.jsp │ ├── index.jsp │ └── split_bar.jsp └── validate │ ├── js │ ├── Message_zh_CN.js │ ├── additional-methods.min.js │ ├── jquery-1.11.3.min.js │ ├── jquery.metadata.js │ └── jquery.validate.min.js │ ├── login.js │ └── member_insert.js ├── 数据库脚本.sql └── 需要的jar包.zip /.idea/artifacts/OnlineBooks_war_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/OnlineBooks_war_exploded 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql 6 | true 7 | com.mysql.jdbc.Driver 8 | jdbc:mysql://localhost:3306/booksystem 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/javax_servlet_jsp_jstl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 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 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /OnlineBooks.iml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OnlineBooks 2 | JAVA图书管理系统 3 | ## **主要模块**: 4 | 5 | * 为用户开通借书服务 6 | * 增加图书信息 7 | * 登记图书借出信息 8 | 9 | ## 技术栈: 10 | 11 | JSP+Servlet+Tomcat9.0+IDEA+Mysql 12 | 13 | 前台登录验证使用框架 14 | 15 | 数据库脚本包括登录用户名和密码已经写在了**数据库脚本.sql** 中 16 | 17 | 解压“需要的jar包”添加到项目的dependency中 18 | 19 | 20 | ## 运行效果: 21 | ![](./web/YF.png '运行效果') 22 | 23 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/IAdminDAO.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO; 2 | 3 | import cn.ylcto.book.vo.Admin; 4 | 5 | import java.sql.SQLException; 6 | 7 | //定义IAdminDAO借口并继承IDAO借口 8 | public interface IAdminDAO extends IDAO { 9 | /** 10 | * 实现用户登录检查操作 11 | * @param vo 表示要执行检查的对象(aid,password,flag 12 | * @return 成功返回true,失败返回 13 | * @throws SQLException 14 | */ 15 | public boolean findLogin(Admin vo)throws SQLException; 16 | 17 | /** 18 | * 实现用户数据更新操作 19 | * @param aid 表示要更新的主键 20 | * @return 21 | * @throws SQLException 22 | */ 23 | public boolean doUpdateByLastDate(String aid) throws SQLException; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/IBooksDAO.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO; 2 | 3 | import cn.ylcto.book.vo.Books; 4 | 5 | public interface IBooksDAO extends IDAO { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/IDAO.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO; 2 | 3 | import java.sql.SQLException; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | /** 8 | * 这个借口表示一个公共的DAO借口 9 | * @param 表示主键 10 | * @param 表示要操作的对象 11 | * */ 12 | public interface IDAO { 13 | /** 14 | *实现数据增加操作 15 | * @param vo 表示要执行操作的对象 16 | * @return 成功返回true,失败返回false 17 | * @throws SQLException 18 | * */ 19 | public boolean doCreate(V vo)throws SQLException; 20 | 21 | /** 22 | *实现数据更新操作 23 | * @param vo 表示要执行更新的对象 24 | * @return 成功返回true,失败返回false 25 | * @throws SQLException 26 | */ 27 | public boolean doUpdate(V vo)throws SQLException; 28 | 29 | /** 30 | * 实现数据批量删除 31 | * @param ids 表示要执行删除的数据集合 32 | * @return 成功返回true,失败返回false 33 | * @throws SQLException 34 | */ 35 | public boolean doRemove(Set ids)throws SQLException; 36 | 37 | /** 38 | * 根据用户提供的id进行查询 39 | * @param id 表使用执行查询的行 40 | * @return 查询成功返回该数据行中的记录,失败返回null 41 | * @throws SQLException 42 | */ 43 | public V findById(K id)throws SQLException; 44 | 45 | /** 46 | * 实现数据全部查询 47 | * @return成功返回所有数据,失败返回null 48 | * @throws SQLException 49 | */ 50 | public List findAll()throws SQLException; 51 | 52 | /** 53 | * 实现数据分页操作 54 | * @param column 表示要执行查询列 55 | * @param keyWord 表示查询关键字 56 | * @param currentPage 表示当前页 57 | * @param lineSize 表示每页记录数 58 | * @return 成功返回满足条件的数据,失败时返回null 59 | * @throws SQLException 60 | */ 61 | public List findAllBySplit(String column,String keyWord,Integer currentPage,Integer lineSize)throws SQLException; 62 | 63 | /** 64 | * 实现数据量统计操作 65 | * @param column 表示要执行统计列 66 | * @param keyWord 表示统计查询关键字 67 | * @return 成功返回数据量,失败返回null 68 | * @throws SQLException 69 | */ 70 | public Integer getAllCount(String column,String keyWord)throws SQLException; 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/IItemDAO.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO; 2 | 3 | import cn.ylcto.book.vo.Item; 4 | 5 | public interface IItemDAO extends IDAO { 6 | } 7 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/ILenbookDAO.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO; 2 | 3 | import cn.ylcto.book.vo.Lenbook; 4 | 5 | public interface ILenbookDAO extends IDAO { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/IMemberDao.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO; 2 | 3 | import cn.ylcto.book.vo.Member; 4 | 5 | public interface IMemberDao extends IDAO{ 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/impl/AdminDAOImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO.impl; 2 | 3 | import cn.ylcto.book.vo.Admin; 4 | import cn.ylcto.book.DAO.IAdminDAO; 5 | import cn.ylcto.util.test.AbstractDAOImpl; 6 | 7 | import java.sql.Connection; 8 | import java.sql.ResultSet; 9 | import java.sql.SQLException; 10 | import java.sql.Timestamp; 11 | import java.util.ArrayList; 12 | import java.util.Date; 13 | import java.util.List; 14 | import java.util.Set; 15 | 16 | public class AdminDAOImpl extends AbstractDAOImpl implements IAdminDAO{ 17 | public AdminDAOImpl(Connection conn) { 18 | super(conn); 19 | } 20 | 21 | @Override 22 | public boolean findLogin(Admin vo) throws SQLException { 23 | boolean flag = false; 24 | String sql = "SELECT lastdate FROM admin WHERE aid=? AND password=? AND flag=1"; 25 | super.pstmt = super.conn.prepareStatement(sql); 26 | super.pstmt.setString(1,vo.getAid()); 27 | super.pstmt.setString(2,vo.getPassword()); 28 | ResultSet rs = super.pstmt.executeQuery(); 29 | if(rs.next()){ 30 | flag = true; 31 | vo.setLastdate(rs.getTimestamp(1));//这行是啥?? 32 | } 33 | 34 | return flag; 35 | } 36 | 37 | @Override 38 | public boolean doUpdateByLastDate(String aid) throws SQLException { 39 | String sql = "UPDATE admin SET lastdate=?WHERE aid=?"; 40 | super.pstmt = super.conn.prepareStatement(sql); 41 | //登录成功后不直接使用当前日前为最后一次登录日期 42 | super.pstmt.setTimestamp(1,new Timestamp(new Date().getTime())); 43 | super.pstmt.setString(2,aid); 44 | return super.pstmt.executeUpdate()>0; 45 | } 46 | 47 | @Override 48 | public boolean doCreate(Admin vo) throws SQLException { 49 | return false; 50 | } 51 | 52 | @Override 53 | public boolean doUpdate(Admin vo) throws SQLException { 54 | return false; 55 | } 56 | 57 | @Override 58 | public boolean doRemove(Set ids) throws SQLException { 59 | return false; 60 | } 61 | 62 | @Override 63 | public Admin findById(String id) throws SQLException { 64 | return null; 65 | } 66 | 67 | @Override 68 | public List findAll() throws SQLException { 69 | List all = new ArrayList(); 70 | String sql = "SELECT aid,password,lastdate,flag,status FROM admin"; 71 | super.pstmt = super.conn.prepareStatement(sql); 72 | ResultSet rs = super.pstmt.executeQuery(); 73 | while(rs.next()){ 74 | Admin vo = new Admin(); 75 | vo.setAid(rs.getString(1)); 76 | vo.setPassword(rs.getString(2)); 77 | vo.setLastdate(rs.getTimestamp(3)); 78 | vo.setFlag(rs.getInt(4)); 79 | vo.setStatus(rs.getInt(5)); 80 | all.add(vo); 81 | 82 | } 83 | return all; 84 | } 85 | 86 | @Override 87 | public List findAllBySplit(String column, String keyWord, Integer currentPage, Integer lineSize) throws SQLException { 88 | return null; 89 | } 90 | 91 | @Override 92 | public Integer getAllCount(String column, String keyWord) throws SQLException { 93 | return null; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/impl/BooksDAOImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO.impl; 2 | 3 | import cn.ylcto.book.DAO.IBooksDAO; 4 | import cn.ylcto.book.vo.Admin; 5 | import cn.ylcto.book.vo.Books; 6 | import cn.ylcto.book.vo.Item; 7 | import cn.ylcto.util.test.AbstractDAOImpl; 8 | 9 | import java.sql.Connection; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.sql.Timestamp; 13 | import java.util.ArrayList; 14 | import java.util.Date; 15 | import java.util.List; 16 | import java.util.Set; 17 | 18 | public class BooksDAOImpl extends AbstractDAOImpl implements IBooksDAO { 19 | public BooksDAOImpl(Connection conn) { 20 | super(conn); 21 | } 22 | 23 | @Override 24 | public boolean doCreate(Books vo) throws SQLException { 25 | String sql = "INSERT INTO books(iid,aid,name,credate,status,note)VALUES(?,?,?,?,?,?)"; 26 | super.pstmt = super.conn.prepareStatement(sql); 27 | super.pstmt.setInt(1,vo.getItem().getIid()); 28 | super.pstmt.setString(2,vo.getAdmin().getAid()); 29 | super.pstmt.setString(3,vo.getName()); 30 | super.pstmt.setTimestamp(4, new Timestamp(vo.getCredate().getTime())); 31 | super.pstmt.setInt(5,vo.getStatus()); 32 | super.pstmt.setString(6,vo.getNote()); 33 | return super.pstmt.executeUpdate() > 0; 34 | } 35 | 36 | @Override 37 | public boolean doUpdate(Books vo) throws SQLException { 38 | return false; 39 | } 40 | 41 | @Override 42 | public boolean doRemove(Set ids) throws SQLException { 43 | return false; 44 | } 45 | 46 | @Override 47 | public Books findById(Integer id) throws SQLException { 48 | return null; 49 | } 50 | 51 | @Override 52 | public List findAll() throws SQLException { 53 | List all = new ArrayList(); 54 | String sql ="SELECT bid,iid,aid,name,credate,status,note FROM books"; 55 | super.pstmt = super.conn.prepareStatement(sql); 56 | ResultSet rs = super.pstmt.executeQuery(); 57 | while (rs.next()){ 58 | Books vo = new Books(); 59 | vo.setBid(rs.getInt(1)); 60 | Item item = new Item(); 61 | item.setIid(rs.getInt(2)); 62 | vo.setItem(item); 63 | Admin admin = new Admin(); 64 | admin.setAid(rs.getString(3)); 65 | vo.setAdmin(admin); 66 | vo.setName(rs.getString(4)); 67 | vo.setCredate(rs.getDate(5)); 68 | vo.setStatus(rs.getInt(6)); 69 | vo.setNote(rs.getString(7)); 70 | all.add(vo); 71 | } 72 | return all; 73 | } 74 | 75 | @Override 76 | public List findAllBySplit(String column, String keyWord, Integer currentPage, Integer lineSize) throws SQLException { 77 | List all = new ArrayList(); 78 | String sql = " SELECT b.bid,b.name,b.credate,b.status,a.aid,i.name " + 79 | " FROM books b,admin a ,item i " + 80 | " WHERE b.iid= i.iid AND b.aid = a.aid AND b."+ column +" LIKE ? LIMIT ?,? "; 81 | super.pstmt = super.conn.prepareStatement(sql); 82 | super.pstmt.setString(1,"%"+keyWord+"%"); 83 | super.pstmt.setInt(2,(currentPage -1) *lineSize); 84 | super.pstmt.setInt(3,lineSize); 85 | ResultSet rs = super.pstmt.executeQuery(); 86 | while (rs.next()){ 87 | Books vo = new Books(); 88 | vo.setBid(rs.getInt(1)); 89 | vo.setName(rs.getString(2)); 90 | vo.setCredate(rs.getDate(3)); 91 | vo.setStatus(rs.getInt(4)); 92 | Admin admin = new Admin(); 93 | admin.setAid(rs.getString(5)); 94 | vo.setAdmin(admin); 95 | Item item = new Item(); 96 | item.setName(rs.getString(6)); 97 | vo.setItem(item); 98 | all.add(vo); 99 | } 100 | return all; 101 | } 102 | 103 | @Override 104 | public Integer getAllCount(String column, String keyWord) throws SQLException { 105 | String sql = "SELECT COUNT(*) FROM books WHERE "+column +" LIKE ?"; 106 | super.pstmt = super.conn.prepareStatement(sql); 107 | super.pstmt.setString(1,"%"+keyWord+"%"); 108 | ResultSet rs = super.pstmt.executeQuery(); 109 | if (rs.next()){ 110 | return rs.getInt(1); 111 | } 112 | return 0; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/impl/ItemDAOImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO.impl; 2 | 3 | import cn.ylcto.book.DAO.IItemDAO; 4 | import cn.ylcto.book.vo.Item; 5 | import cn.ylcto.util.test.AbstractDAOImpl; 6 | 7 | import java.sql.Connection; 8 | import java.sql.ResultSet; 9 | import java.sql.SQLException; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Set; 13 | 14 | public class ItemDAOImpl extends AbstractDAOImpl implements IItemDAO { 15 | public ItemDAOImpl(Connection conn) { 16 | super(conn); 17 | } 18 | 19 | @Override 20 | public boolean doCreate(Item vo) throws SQLException { 21 | String sql = "INSERT INTO item(name,note) VALUES(?,?)"; 22 | super.pstmt = super.conn.prepareStatement(sql); 23 | super.pstmt.setString(1,vo.getName()); 24 | super.pstmt.setString(2,vo.getNote()); 25 | return super.pstmt.executeUpdate()>0; 26 | } 27 | 28 | @Override 29 | public boolean doUpdate(Item vo) throws SQLException { 30 | return false; 31 | } 32 | 33 | @Override 34 | public boolean doRemove(Set ids) throws SQLException { 35 | return false; 36 | } 37 | 38 | @Override 39 | public Item findById(Integer id) throws SQLException { 40 | Item vo = null; 41 | String sql = "SELECT iid,name,note FROM item WHERE iid=?"; 42 | super.pstmt = super.conn.prepareStatement(sql); 43 | super.pstmt.setInt(1,id); 44 | ResultSet rs = super.pstmt.executeQuery(); 45 | if(rs.next()){ 46 | vo=new Item(); 47 | vo.setIid(rs.getInt(1)); 48 | vo.setName(rs.getString(2)); 49 | vo.setNote(rs.getString(3)); 50 | } 51 | return vo; 52 | } 53 | 54 | @Override 55 | public List findAll() throws SQLException { 56 | List all = new ArrayList(); 57 | String sql = "SELECT iid,name,note FROM item"; 58 | super.pstmt = super.conn.prepareStatement(sql); 59 | ResultSet rs = super.pstmt.executeQuery(); 60 | while(rs.next()){ 61 | Item vo=new Item(); 62 | vo.setIid(rs.getInt(1)); 63 | vo.setName(rs.getString(2)); 64 | vo.setNote(rs.getString(3)); 65 | all.add(vo); 66 | } 67 | return all; 68 | } 69 | 70 | @Override 71 | public List findAllBySplit(String column, String keyWord, Integer currentPage, Integer lineSize) throws SQLException { 72 | return null; 73 | } 74 | 75 | @Override 76 | public Integer getAllCount(String column, String keyWord) throws SQLException { 77 | return null; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/impl/LenbookDAOimpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO.impl; 2 | 3 | import cn.ylcto.book.DAO.ILenbookDAO; 4 | import cn.ylcto.book.vo.Lenbook; 5 | import cn.ylcto.util.test.AbstractDAOImpl; 6 | 7 | import java.sql.Connection; 8 | import java.sql.SQLException; 9 | import java.sql.Timestamp; 10 | import java.util.List; 11 | import java.util.Set; 12 | 13 | public class LenbookDAOimpl extends AbstractDAOImpl implements ILenbookDAO{ 14 | public LenbookDAOimpl(Connection conn) { 15 | super(conn); 16 | } 17 | 18 | @Override 19 | public boolean doCreate(Lenbook vo) throws SQLException { 20 | String sql = "INSERT INTO lenbook(bid,mid,credate) VALUES(?,?,?)"; 21 | super.pstmt = super.conn.prepareStatement(sql); 22 | super.pstmt.setInt(1,vo.getBooks().getBid()); 23 | super.pstmt.setString(2,vo.getMember().getMid ); 24 | super.pstmt.setTimestamp(3,new Timestamp(vo.getCredate().getTime())); 25 | 26 | return super.pstmt.executeUpdate()>0; 27 | } 28 | 29 | @Override 30 | public boolean doUpdate(Lenbook vo) throws SQLException { 31 | return false; 32 | } 33 | 34 | @Override 35 | public boolean doRemove(Set ids) throws SQLException { 36 | return false; 37 | } 38 | 39 | @Override 40 | public Lenbook findById(Integer id) throws SQLException { 41 | return null; 42 | } 43 | 44 | @Override 45 | public List findAll() throws SQLException { 46 | return null; 47 | } 48 | 49 | @Override 50 | public List findAllBySplit(String column, String keyWord, Integer currentPage, Integer lineSize) throws SQLException { 51 | return null; 52 | } 53 | 54 | @Override 55 | public Integer getAllCount(String column, String keyWord) throws SQLException { 56 | return null; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/DAO/impl/MemberDaoImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.DAO.impl; 2 | 3 | import cn.ylcto.book.DAO.IMemberDao; 4 | import cn.ylcto.book.vo.Member; 5 | import cn.ylcto.util.test.AbstractDAOImpl; 6 | 7 | import java.sql.Connection; 8 | import java.sql.ResultSet; 9 | import java.sql.SQLException; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Set; 13 | 14 | public class MemberDaoImpl extends AbstractDAOImpl implements IMemberDao{ 15 | public MemberDaoImpl(Connection conn) { 16 | super(conn); 17 | } 18 | 19 | @Override 20 | public boolean doCreate(Member vo) throws SQLException { 21 | String sql = "INSERT INTO member(mid,name,age,sex,phone) VALUES(?,?,?,?,?)"; 22 | super.pstmt = super.conn.prepareStatement(sql); 23 | super.pstmt.setString(1,vo.getMid()); 24 | super.pstmt.setString(2,vo.getName()); 25 | super.pstmt.setInt(3,vo.getAge()); 26 | super.pstmt.setInt(4,vo.getSex()); 27 | super.pstmt.setString(5,vo.getPhone()); 28 | return super.pstmt.executeUpdate()>0; 29 | } 30 | 31 | @Override 32 | public boolean doUpdate(Member vo) throws SQLException { 33 | return false; 34 | } 35 | 36 | @Override 37 | public boolean doRemove(Set ids) throws SQLException { 38 | return false; 39 | } 40 | 41 | @Override 42 | public Member findById(String id) throws SQLException { 43 | Member vo = null; 44 | String sql = "SELECT mid,name,age,sex,phone FROM member WHERE mid=?"; 45 | super.pstmt = super.conn.prepareStatement(sql); 46 | super.pstmt.setString(1,id); 47 | ResultSet rs = super.pstmt.executeQuery(); 48 | if (rs.next()){ 49 | vo = new Member(); 50 | vo.setMid(rs.getString(1)); 51 | vo.setName(rs.getString(2)); 52 | vo.setAge(rs.getInt(3)); 53 | vo.setSex(rs.getInt(4)); 54 | vo.setPhone(rs.getString(5)); 55 | } 56 | return vo; 57 | } 58 | 59 | @Override 60 | public List findAll() throws SQLException { 61 | List all = new ArrayList(); 62 | String sql = "select mid,name from member"; 63 | super.pstmt = super.conn.prepareStatement(sql); 64 | ResultSet rs =super.pstmt.executeQuery(); 65 | while(rs.next()){ 66 | Member vo = new Member(); 67 | vo.setMid(rs.getString(1)); 68 | vo.setName(rs.getString(2)); 69 | all.add(vo); 70 | } 71 | return all; 72 | } 73 | 74 | @Override 75 | public List findAllBySplit(String column, String keyWord, Integer currentPage, Integer lineSize) throws SQLException { 76 | return null; 77 | } 78 | 79 | @Override 80 | public Integer getAllCount(String column, String keyWord) throws SQLException { 81 | return null; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/dbc/DatabaseConnection.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.dbc; 2 | import java.sql.*; 3 | 4 | public class DatabaseConnection { 5 | private static final String DBDRIVER = "com.mysql.jdbc.Driver"; 6 | private static final String DBURL = "jdbc:mysql://localhost:3306/booksystem"; 7 | private static final String DBUSER = "root"; 8 | private static final String DBPASS = "gsy199605"; 9 | 10 | private Connection conn; 11 | 12 | public DatabaseConnection(){ 13 | try { 14 | Class.forName(DBDRIVER); 15 | this.conn = DriverManager.getConnection(DBURL,DBUSER,DBPASS); 16 | } catch (ClassNotFoundException e) { 17 | e.printStackTrace(); 18 | } catch (SQLException e) { 19 | e.printStackTrace(); 20 | } 21 | } 22 | public Connection getConn(){ 23 | return this.conn; 24 | } 25 | public void close(){ 26 | if (this.conn != null){ 27 | try { 28 | this.conn.close(); 29 | } catch (SQLException e) { 30 | e.printStackTrace(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/factory/DAOFactory.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.factory; 2 | 3 | import cn.ylcto.book.DAO.*; 4 | import cn.ylcto.book.DAO.impl.*; 5 | 6 | import java.sql.Connection; 7 | //工厂类 8 | public class DAOFactory { 9 | public static IAdminDAO getAdminDAOInstance(Connection conn){ 10 | return new AdminDAOImpl(conn); 11 | } 12 | public static IMemberDao getIMemberDAOInstance(Connection conn){ 13 | return new MemberDaoImpl(conn); 14 | } 15 | public static IItemDAO getIItemDAOInstance(Connection conn){ 16 | return new ItemDAOImpl(conn); 17 | } 18 | public static IBooksDAO getIBooksDAOInstance(Connection conn){ 19 | return new BooksDAOImpl(conn); 20 | } 21 | public static ILenbookDAO getILenbookDAOInstance(Connection conn){return new LenbookDAOimpl(conn);} 22 | } 23 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/factory/ServiceFactory.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.factory; 2 | 3 | import cn.ylcto.book.service.*; 4 | import cn.ylcto.book.service.impl.*; 5 | import cn.ylcto.book.servlet.AdminServlet; 6 | 7 | //服务层工厂类 8 | public class ServiceFactory { 9 | public static IAdminService getIAdminServiceInstance() { 10 | return new AdminServiceImpl(); 11 | } 12 | public static IMemberService getIMemberServiceInstance(){return new MemberServiceImpl();} 13 | public static IItemService getIItemServiceInstance(){return new ItemServiceImpl(); } 14 | public static IBooksService getIBooksServiceInstance(){ 15 | return new BooksServiceImpl(); 16 | } 17 | public static ILenbookService getILenbooksServiceInstance(){return new LenbookServiceImpl();} 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/filter/AdminLoginFilter.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.filter; 2 | 3 | import javax.servlet.*; 4 | import javax.servlet.annotation.WebFilter; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpSession; 8 | import java.io.IOException; 9 | @WebFilter(filterName = "AdminLoginFilter",urlPatterns = {"/pages/back/member/*","/pages/back/item/*","/pages/index.jsp"}) 10 | public class AdminLoginFilter implements Filter{ 11 | @Override 12 | public void init(FilterConfig filterConfig) throws ServletException { 13 | 14 | } 15 | 16 | @Override 17 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 18 | HttpServletRequest request = (HttpServletRequest) servletRequest; 19 | HttpSession session = request.getSession();//取得session借口对象 20 | if(session.getAttribute("aid")!=null) {//表示有内容存在 21 | filterChain.doFilter(servletRequest, servletResponse); 22 | }else { 23 | request.setAttribute("msg","您还未登录,请先登录后操作"); 24 | request.setAttribute("url","/login.jsp"); 25 | request.getRequestDispatcher("/pages/forward.jsp").forward(servletRequest,servletResponse); 26 | } 27 | 28 | } 29 | 30 | @Override 31 | public void destroy() { 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/IAdminService.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service; 2 | 3 | import cn.ylcto.book.vo.Admin; 4 | 5 | 6 | public interface IAdminService { 7 | /** 8 | * 实现管理员登录检查操作,调用IAdminDAO接口中的findLogin方法 9 | * @param vo 表示要操作的对象,包括aid,password 10 | * @return 成功返回true,并且将最后一次登录日期 传递到页面,失败返回false 11 | * @throws Exception 12 | */ 13 | public boolean login(Admin vo) throws Exception; 14 | 15 | /** 16 | * 更新最后一次登录日期 17 | * @param aid 18 | * @return 19 | * @throws Exception 20 | */ 21 | public boolean updateByLastDate(String aid) throws Exception; 22 | } 23 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/IBooksService.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service; 2 | 3 | import cn.ylcto.book.vo.Books; 4 | 5 | import java.awt.print.Book; 6 | import java.util.Map; 7 | 8 | public interface IBooksService { 9 | /** 10 | * 增加图书详情 11 | * @param vo 表示要执行数据增加的对象 12 | * @return 成功返回true,失败返回false 13 | * @throws Exception 14 | */ 15 | public boolean insert(Books vo) throws Exception; 16 | 17 | /** 18 | * 此方法表示执行查询Admin表和item表中的全部数据 19 | * @return 20 | * @throws Exception 21 | */ 22 | public Map findByAdminAndItem() throws Exception; 23 | 24 | /** 25 | * 定义分页接口类 26 | * @param column 27 | * @param keyWord 28 | * @param currentPage 29 | * @param lineSize 30 | * @return 31 | * @throws Exception 32 | */ 33 | public Map listBySplit(String column,String keyWord,int currentPage,int lineSize) throws Exception; 34 | } 35 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/IItemService.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service; 2 | 3 | import cn.ylcto.book.vo.Item; 4 | 5 | import java.util.List; 6 | 7 | public interface IItemService { 8 | /** 9 | * 实现分类的增加操作 10 | * @param vo 表示要执行的vod对象 11 | * @return 成功返回true,失败返回false 12 | * @throws Exception 13 | */ 14 | public boolean insert(Item vo)throws Exception; 15 | 16 | /** 17 | * 实现数据全部查询操作 18 | * @return 19 | * @throws Exception 20 | */ 21 | public List list() throws Exception; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/ILenbookService.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service; 2 | 3 | import cn.ylcto.book.vo.Lenbook; 4 | 5 | import java.util.Map; 6 | 7 | public interface ILenbookService { 8 | /** 9 | * 实现数据增加操作 10 | * @param vo 11 | * @return 12 | * @throws Exception 13 | */ 14 | public boolean insert(Lenbook vo) throws Exception; 15 | 16 | /** 17 | * 取得books数据和member表中数据 18 | * @return 19 | * @throws Exception 20 | */ 21 | public Map listByMemberAndBooks() throws Exception; 22 | } 23 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/IMemberService.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service; 2 | 3 | import cn.ylcto.book.vo.Member; 4 | 5 | public interface IMemberService { 6 | /** 7 | * 实现数据增加操作 8 | * @param vo 表示要执行增加的对象 9 | * @return 10 | * @throws Exception 11 | */ 12 | public boolean insert(Member vo) throws Exception; 13 | } 14 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/impl/AdminServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service.impl; 2 | 3 | import cn.ylcto.book.vo.Admin; 4 | import cn.ylcto.book.dbc.DatabaseConnection; 5 | import cn.ylcto.book.factory.DAOFactory; 6 | import cn.ylcto.book.service.IAdminService; 7 | 8 | public class AdminServiceImpl implements IAdminService{ 9 | private DatabaseConnection dbc = new DatabaseConnection(); 10 | @Override 11 | public boolean login(Admin vo) throws Exception { 12 | try{ 13 | //如果登录成功 14 | if (DAOFactory.getAdminDAOInstance(this.dbc.getConn()).findLogin(vo)) { 15 | return DAOFactory.getAdminDAOInstance(this.dbc.getConn()).doUpdateByLastDate(vo.getAid()); 16 | } 17 | return false; 18 | 19 | } 20 | catch (Exception e){ 21 | throw e; 22 | }finally { 23 | this.dbc.close(); 24 | } 25 | 26 | } 27 | 28 | @Override 29 | public boolean updateByLastDate(String aid) throws Exception { 30 | return false; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/impl/BooksServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service.impl; 2 | 3 | import cn.ylcto.book.dbc.DatabaseConnection; 4 | import cn.ylcto.book.factory.DAOFactory; 5 | import cn.ylcto.book.service.IBooksService; 6 | import cn.ylcto.book.vo.Books; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class BooksServiceImpl implements IBooksService{ 12 | private DatabaseConnection dbc = new DatabaseConnection(); 13 | 14 | @Override 15 | public boolean insert(Books vo) throws Exception { 16 | try { 17 | return DAOFactory.getIBooksDAOInstance(this.dbc.getConn()).doCreate(vo); 18 | }catch (Exception e){ 19 | throw e; 20 | }finally { 21 | this.dbc.close(); 22 | } 23 | 24 | } 25 | 26 | @Override 27 | public Map findByAdminAndItem() throws Exception { 28 | try { 29 | Map map = new HashMap(); 30 | map.put("allAdmins",DAOFactory.getAdminDAOInstance(this.dbc.getConn()).findAll()); 31 | map.put("allItems",DAOFactory.getIItemDAOInstance(this.dbc.getConn()).findAll()); 32 | return map; 33 | }catch (Exception e){ 34 | throw e; 35 | }finally { 36 | this.dbc.close(); 37 | 38 | } 39 | } 40 | 41 | @Override 42 | public Map listBySplit(String column, String keyWord, int currentPage, int lineSize) throws Exception { 43 | try { 44 | Map map = new HashMap(); 45 | map.put("allBooks", DAOFactory.getIBooksDAOInstance(this.dbc.getConn()).findAllBySplit(column, keyWord, currentPage, lineSize)); 46 | map.put("allCounts", DAOFactory.getIBooksDAOInstance(this.dbc.getConn()).getAllCount(column, keyWord)); 47 | return map; 48 | } catch (Exception e) { 49 | throw e; 50 | } finally { 51 | this.dbc.close(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/impl/ItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service.impl; 2 | 3 | import cn.ylcto.book.dbc.DatabaseConnection; 4 | import cn.ylcto.book.factory.DAOFactory; 5 | import cn.ylcto.book.service.IItemService; 6 | import cn.ylcto.book.vo.Item; 7 | 8 | import java.util.List; 9 | 10 | public class ItemServiceImpl implements IItemService{ 11 | private DatabaseConnection dbc = new DatabaseConnection(); 12 | @Override 13 | public boolean insert(Item vo) throws Exception { 14 | try { 15 | return DAOFactory.getIItemDAOInstance(this.dbc.getConn()).doCreate(vo); 16 | }catch (Exception e){ 17 | throw e; 18 | }finally { 19 | this.dbc.close(); 20 | } 21 | 22 | 23 | } 24 | 25 | @Override 26 | public List list() throws Exception { 27 | try { 28 | return DAOFactory.getIItemDAOInstance(this.dbc.getConn()).findAll(); 29 | }catch (Exception e){ 30 | throw e; 31 | }finally { 32 | this.dbc.close(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/impl/LenbookServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service.impl; 2 | 3 | import cn.ylcto.book.DAO.ILenbookDAO; 4 | import cn.ylcto.book.dbc.DatabaseConnection; 5 | import cn.ylcto.book.factory.DAOFactory; 6 | import cn.ylcto.book.service.ILenbookService; 7 | import cn.ylcto.book.vo.Lenbook; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | public class LenbookServiceImpl implements ILenbookService { 13 | private DatabaseConnection dbc = new DatabaseConnection(); 14 | 15 | @Override 16 | public boolean insert(Lenbook vo) throws Exception { 17 | try { 18 | return DAOFactory.getILenbookDAOInstance(this.dbc.getConn()).doCreate(vo); 19 | } catch (Exception e) { 20 | throw e; 21 | } finally { 22 | this.dbc.close(); 23 | } 24 | 25 | 26 | } 27 | 28 | @Override 29 | public Map listByMemberAndBooks() throws Exception { 30 | Map map = new HashMap(); 31 | try { 32 | map.put("allBooks",DAOFactory.getILenbookDAOInstance(this.dbc.getConn()).findAll()); 33 | map.put("allMembers",DAOFactory.getIMemberDAOInstance(this.dbc.getConn()).findAll()); 34 | return map; 35 | 36 | } catch (Exception e) { 37 | throw e; 38 | } finally { 39 | this.dbc.close(); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/service/impl/MemberServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.service.impl; 2 | 3 | import cn.ylcto.book.dbc.DatabaseConnection; 4 | import cn.ylcto.book.factory.DAOFactory; 5 | import cn.ylcto.book.service.IMemberService; 6 | import cn.ylcto.book.vo.Member; 7 | 8 | public class MemberServiceImpl implements IMemberService{ 9 | private DatabaseConnection dbc = new DatabaseConnection(); 10 | @Override 11 | public boolean insert(Member vo) throws Exception { 12 | try{ 13 | if(DAOFactory.getIMemberDAOInstance(this.dbc.getConn()).findById(vo.getMid()) == null) 14 | return DAOFactory.getIMemberDAOInstance(this.dbc.getConn()).doCreate(vo); 15 | }catch (Exception e){ 16 | throw e; 17 | }finally { 18 | this.dbc.close(); 19 | } 20 | return false; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/servlet/AdminServlet.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.servlet; 2 | 3 | import cn.ylcto.book.vo.Admin; 4 | import cn.ylcto.book.factory.ServiceFactory; 5 | import cn.ylcto.util.MD5Code; 6 | import cn.ylcto.util.validate.ValidateUtils; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.annotation.WebServlet; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.io.IOException; 14 | 15 | @WebServlet(name = "AdminServlet",urlPatterns = "/pages/back/AdminServlet/*") 16 | public class AdminServlet extends HttpServlet { 17 | @Override 18 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 19 | this.doGet(request,response); 20 | } 21 | @Override 22 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 23 | String path = "/pages/errors.jsp";//定义错误页面 24 | String status = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1); 25 | System.out.println(status); 26 | if(status != null){ 27 | if("login".equals(status)){ 28 | path = this.login(request); 29 | } 30 | } 31 | 32 | request.getRequestDispatcher(path).forward(request,response); 33 | } 34 | public String login(HttpServletRequest request) { 35 | String msg = "";//表示提示信息 36 | String url = "";//表示跳转路径 37 | //取得页面中传递过来的数据 38 | String aid = request.getParameter("aid"); 39 | String password = request.getParameter("password"); 40 | 41 | //判断数据是否为空 42 | if(ValidateUtils.validateEmpty(aid) && ValidateUtils.validateEmpty(password)){//表示数据存在 43 | Admin vo = new Admin(); 44 | vo.setAid(aid);//取得参数 45 | vo.setPassword(new MD5Code().getMD5ofStr(password+aid));//需要加盐处理 46 | //System.out.println(vo.getPassword());//用于测试输出加盐密码 47 | try{ 48 | if(ServiceFactory.getIAdminServiceInstance().login(vo)) { 49 | request.getSession().setAttribute("aid",aid);//保存aid 50 | 51 | request.getSession().setAttribute("lastdate",vo.getLastdate()); 52 | msg = "登录成功"; 53 | url = "/pages/index.jsp"; 54 | }else{ 55 | msg = "登录失败,错误的ID或密码"; 56 | url = "/login.jsp"; 57 | } 58 | }catch (Exception e){ 59 | e.printStackTrace(); 60 | } 61 | 62 | } 63 | 64 | else{ 65 | msg = "数据不能为空"; 66 | url = "/kong.jsp"; 67 | } 68 | request.setAttribute("msg",msg); 69 | request.setAttribute("url",url); 70 | return "/pages/forward.jsp"; 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/servlet/BooksServlet.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.servlet; 2 | 3 | import cn.ylcto.book.factory.ServiceFactory; 4 | import cn.ylcto.book.vo.Admin; 5 | import cn.ylcto.book.vo.Books; 6 | import cn.ylcto.book.vo.Item; 7 | import cn.ylcto.util.validate.ValidateUtils; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | import java.util.Date; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | @WebServlet(name = "booksServlet",urlPatterns = "/pages/back/books/BooksServlet/*") 20 | public class BooksServlet extends HttpServlet { 21 | @Override 22 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 23 | this.doGet(request, response); 24 | } 25 | @Override 26 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | String path = "/pages/errors.jsp"; // 定义错误页面 28 | String status = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1); 29 | if(status != null){ 30 | if ("insertPro".equals(status)){ 31 | path = this.insertPro(request); 32 | }else if("insert".equals(status)){ 33 | System.out.println(path); 34 | path = this.insert(request,response); 35 | }else if("listSplit".equals(status)){ 36 | path = this.listSplit(request,response); 37 | } 38 | } 39 | request.getRequestDispatcher(path).forward(request,response); 40 | } 41 | 42 | public String listSplit(HttpServletRequest request, HttpServletResponse response) { 43 | int currentPage = 1; 44 | int lineSize = 1; 45 | try { 46 | currentPage = Integer.parseInt(request.getParameter("cp")); 47 | }catch (Exception e){} 48 | try { 49 | lineSize = Integer.parseInt(request.getParameter("ls")); 50 | }catch (Exception e){} 51 | String keyWord = request.getParameter("kw"); 52 | String column = request.getParameter("col"); 53 | if(keyWord == null){ 54 | keyWord = ""; 55 | } 56 | if (column == null){ 57 | column = "name"; 58 | } 59 | 60 | try { 61 | Map map = ServiceFactory.getIBooksServiceInstance().listBySplit(column,keyWord,currentPage,lineSize); 62 | request.setAttribute("allBooks",map.get("allBooks")); 63 | request.setAttribute("allRecorders",map.get("allCounts")); 64 | } catch (Exception e) { 65 | e.printStackTrace(); 66 | } 67 | request.setAttribute("url","/pages/back/books/BooksServlet/listSplit"); 68 | request.setAttribute("currentPage",currentPage); 69 | request.setAttribute("lineSize",lineSize); 70 | return "/pages/back/books/books_list.jsp"; 71 | } 72 | 73 | public String insert(HttpServletRequest request, HttpServletResponse response) { 74 | // msg url ; 75 | String msg = ""; 76 | String url = ""; 77 | // 取得页面中的数据 78 | String name = request.getParameter("name"); 79 | String aid = request.getParameter("aid"); 80 | Integer iid = Integer.parseInt(request.getParameter("iid")); 81 | String note = request.getParameter("note"); 82 | // 判断数据是否为空 83 | if(ValidateUtils.validateEmpty(name) && ValidateUtils.validateEmpty(aid) 84 | && ValidateUtils.validateEmpty(note) ){ 85 | Books vo = new Books(); 86 | vo.setName(name); 87 | Admin admin = new Admin(); 88 | admin.setAid(aid); 89 | vo.setAdmin(admin); 90 | Item item = new Item(); 91 | item.setIid(iid); 92 | vo.setItem(item); 93 | vo.setCredate(new Date()); 94 | vo.setStatus(1); // 1表示上架 0表示下架操作 95 | vo.setNote(note); 96 | try { 97 | if (ServiceFactory.getIBooksServiceInstance().insert(vo)){ 98 | msg = "数据已经增加成功!"; 99 | url = "/pages/back/books/BooksServlet/insertPro"; 100 | }else{ 101 | msg = "你输入的信息有误,请重新输入"; 102 | url = "/pages/back/books/BooksServlet/insertPro"; 103 | } 104 | } catch (Exception e) { 105 | e.printStackTrace(); 106 | } 107 | }else{ 108 | msg = "你输入的内容为空,请重新输入"; 109 | url = "/pages/back/books/BooksServlet/insertPro"; 110 | } 111 | request.setAttribute("msg",msg); 112 | request.setAttribute("url",url); 113 | return "/pages/forward.jsp"; 114 | } 115 | 116 | public String insertPro(HttpServletRequest request) { 117 | Map map = null; 118 | try { 119 | map = ServiceFactory.getIBooksServiceInstance().findByAdminAndItem(); 120 | } catch (Exception e) { 121 | e.printStackTrace(); 122 | } 123 | request.setAttribute("allItems",map.get("allItems")); 124 | request.setAttribute("allAdmins",map.get("allAdmins")); 125 | return "/pages/back/books/books_insert.jsp"; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/servlet/ItemServlet.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.servlet; 2 | 3 | import cn.ylcto.book.factory.ServiceFactory; 4 | import cn.ylcto.book.vo.Item; 5 | import cn.ylcto.util.validate.ValidateUtils; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.IOException; 13 | @WebServlet(name = "ItemServlet",urlPatterns = "/pages/back/ItemServlet/*") 14 | public class ItemServlet extends HttpServlet { 15 | @Override 16 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 17 | this.doGet(request, response); 18 | } 19 | 20 | @Override 21 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 22 | String path = "/pages/errors.jsp";//定义错误页面 23 | String status = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1); 24 | //表示截取的最后一个字符串 25 | System.out.println(status); 26 | if (status != null) { 27 | if ("insert".equals(status)) { 28 | try { 29 | path = this.insert(request); 30 | } catch (Exception e) { 31 | e.printStackTrace(); 32 | } 33 | }else if("list".equals(status)){ 34 | path = this.list(request); 35 | } 36 | } 37 | 38 | request.getRequestDispatcher(path).forward(request, response); 39 | } 40 | 41 | public String list(HttpServletRequest request){ 42 | try { 43 | request.setAttribute("allItems",ServiceFactory.getIItemServiceInstance().list()); 44 | 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | } 48 | return "/pages/back/member/item_list.jsp"; 49 | } 50 | 51 | /** 52 | * 实现插入 53 | * 54 | * @param request 55 | * @return 56 | */ 57 | public String insert(HttpServletRequest request) throws Exception { 58 | String msg = "";//表示提示信息 59 | String url = "";//表示跳转路径 60 | String name = request.getParameter("name"); 61 | String note = request.getParameter("note"); 62 | System.out.println(name); 63 | System.out.println(note); 64 | //数据验证 65 | if (ValidateUtils.validateEmpty(name) && ValidateUtils.validateEmpty(note)) {//表示数据存在 66 | Item vo = new Item(); 67 | vo.setName(name); 68 | vo.setNote(note); 69 | try { 70 | if (ServiceFactory.getIItemServiceInstance().insert(vo)) { 71 | msg = "数据增加成功"; 72 | url = "/pages/back/member/item_insert.jsp"; 73 | 74 | } 75 | else { 76 | msg = "数据添加失败,请重新添加!"; 77 | url = "/pages/back/item/item_insert.jsp"; 78 | } 79 | 80 | }catch(Exception e){ 81 | e.printStackTrace(); 82 | } 83 | 84 | 85 | }else{ 86 | msg = "数据不能为空"; 87 | url = "/pages/back/member/item_insert.jsp"; 88 | } 89 | request.setAttribute("msg",msg); 90 | request.setAttribute("url",url); 91 | 92 | return "/pages/forward.jsp"; 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/servlet/LenbookServlet.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.servlet; 2 | 3 | import cn.ylcto.book.factory.ServiceFactory; 4 | import cn.ylcto.book.vo.Admin; 5 | import cn.ylcto.book.vo.Books; 6 | import cn.ylcto.book.vo.Lenbook; 7 | import cn.ylcto.book.vo.Member; 8 | import cn.ylcto.util.validate.ValidateUtils; 9 | 10 | import javax.servlet.ServletException; 11 | import javax.servlet.annotation.WebServlet; 12 | import javax.servlet.http.HttpServlet; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.io.IOException; 16 | import javax.servlet.ServletException; 17 | 18 | import cn.ylcto.util.validate.ValidateUtils; 19 | 20 | import javax.servlet.annotation.WebServlet; 21 | import javax.servlet.http.HttpServlet; 22 | import javax.servlet.http.HttpServletRequest; 23 | import javax.servlet.http.HttpServletResponse; 24 | import java.io.IOException; 25 | import java.util.Date; 26 | 27 | @WebServlet(name = "lenbookServlet",urlPatterns = "/pages/back/lenbook/LenbookServlet/*") 28 | public class LenbookServlet extends HttpServlet { 29 | 30 | @Override 31 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | this.doGet(request, response); 33 | } 34 | 35 | @Override 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | String path = "/pages/errors.jsp";//定义错误页面 38 | String status = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1); 39 | //表示截取的最后一个字符串 40 | if (status != null) { 41 | if ("insert".equals(status)) { 42 | path = this.insert(request); 43 | }else if("insertPro".equals(status)){ 44 | path = this.insertPro(request); 45 | } 46 | } 47 | 48 | request.getRequestDispatcher(path).forward(request, response); 49 | } 50 | 51 | 52 | public String insert(HttpServletRequest request) { 53 | String msg = ""; 54 | String url = ""; 55 | //接受参数 56 | int bid = Integer.parseInt(request.getParameter("bid")); 57 | String mid = request.getParameter("mid"); 58 | if(ValidateUtils.validateEmpty(mid)) { 59 | Lenbook vo = new Lenbook(); 60 | Books books = new Books(); 61 | books.setBid(bid); 62 | vo.setBooks(books);//设置图书编号 63 | Member member = new Member(); 64 | member.setMid(mid); 65 | vo.setMember(member); 66 | vo.setCredate(new Date());//表示当前日期 67 | try { 68 | if (ServiceFactory.getILenbooksServiceInstance().insert(vo)) { 69 | msg = "数据增加成功!"; 70 | } else { 71 | msg = "数据增加失败,请重新添加"; 72 | } 73 | } catch (Exception e) { 74 | e.printStackTrace(); 75 | } 76 | }else{ 77 | msg = "输入的内容不允许为空"; 78 | } 79 | request.setAttribute("msg",msg); 80 | request.setAttribute("url","/pages/back/lenbook/lenbook_insert.jsp"); 81 | 82 | return "/pages/forward.jsp"; 83 | } 84 | 85 | public String insertPro(HttpServletRequest request) { 86 | String msg = ""; 87 | String url = ""; 88 | //接受参数 89 | int bid = Integer.parseInt(request.getParameter("bid")); 90 | String mid = request.getParameter("mid"); 91 | if(ValidateUtils.validateEmpty(mid)) { 92 | Lenbook vo = new Lenbook(); 93 | Books books = new Books(); 94 | books.setBid(bid); 95 | vo.setBooks(books);//设置图书编号 96 | Member member = new Member(); 97 | member.setMid(mid); 98 | vo.setMember(member); 99 | vo.setCredate(new Date());//表示当前日期 100 | try { 101 | if (ServiceFactory.getILenbooksServiceInstance().insert(vo)) { 102 | msg = "数据增加成功!"; 103 | } else { 104 | msg = "数据增加失败,请重新添加"; 105 | } 106 | } catch (Exception e) { 107 | e.printStackTrace(); 108 | } 109 | }else{ 110 | msg = "输入的内容不允许为空"; 111 | } 112 | request.setAttribute("msg",msg); 113 | request.setAttribute("url","/pages/back/lenbook/lenbook_insert.jsp"); 114 | 115 | return "/pages/forward.jsp"; 116 | } 117 | 118 | 119 | } 120 | 121 | 122 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/servlet/MemberServlet.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.servlet; 2 | 3 | import cn.ylcto.book.factory.ServiceFactory; 4 | import cn.ylcto.book.vo.Member; 5 | import cn.ylcto.util.validate.ValidateUtils; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.IOException; 13 | @WebServlet(name = "MemberServlet",urlPatterns = "/pages/back/MemberServlet/*") 14 | public class MemberServlet extends HttpServlet { 15 | @Override 16 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 17 | this.doGet(request, response); 18 | } 19 | @Override 20 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 21 | String path = "/pages/errors.jsp";//定义错误页面 22 | String status = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1); 23 | //表示截取的最后一个字符串 24 | if (status != null) { 25 | if ("insert".equals(status)) { 26 | path = this.insert(request); 27 | } 28 | } 29 | System.out.println(status); 30 | request.getRequestDispatcher(path).forward(request, response); 31 | } 32 | 33 | public String insert(HttpServletRequest request){ 34 | String url =""; 35 | String msg =""; 36 | //接收数据 37 | String mid = request.getParameter("mid"); 38 | String name = request.getParameter("name"); 39 | Integer age = Integer.parseInt(request.getParameter("age")); 40 | Integer sex = Integer.parseInt(request.getParameter("sex")); 41 | String phone = request.getParameter("phone"); 42 | //验证数据是否为空 43 | System.out.println(mid); 44 | if(ValidateUtils.validateEmpty(mid)&&ValidateUtils.validateEmpty(name)&& ValidateUtils.validateEmpty(phone)){ 45 | Member vo = new Member(); 46 | vo.setMid(mid); 47 | vo.setName(name); 48 | vo.setSex(sex); 49 | vo.setAge(age); 50 | vo.setPhone(phone); 51 | try { 52 | if (ServiceFactory.getIMemberServiceInstance().insert(vo)){ 53 | url = "/pages/back/member/member_insert.jsp"; 54 | msg = "用户数据增加成功!"; 55 | }else{ 56 | url = "/pages/back/member/member_insert.jsp"; 57 | msg = "用户数据增加失败!"; 58 | } 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | } 62 | 63 | } 64 | 65 | 66 | else{ 67 | url = "/pages/back/member/member_insert.jsp"; 68 | msg = "数据不能为空"; 69 | } 70 | request.setAttribute("url",url); 71 | request.setAttribute("msg",msg); 72 | return "/pages/forward.jsp"; 73 | 74 | 75 | 76 | } 77 | 78 | 79 | } 80 | 81 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/servlet/template.java: -------------------------------------------------------------------------------- 1 | //package cn.ylcto.book.servlet; 2 | // 3 | //import cn.ylcto.util.validate.ValidateUtils; 4 | // 5 | //import javax.servlet.ServletException; 6 | //import javax.servlet.annotation.WebServlet; 7 | //import javax.servlet.http.HttpServlet; 8 | //import javax.servlet.http.HttpServletRequest; 9 | //import javax.servlet.http.HttpServletResponse; 10 | //import java.io.IOException; 11 | //@WebServlet(name = "AdminServlet",urlPatterns = "/pages/back/AdminServlet/*") 12 | //public class template extends HttpServlet { 13 | // @Override 14 | // protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 15 | // this.doGet(request, response); 16 | // } 17 | // 18 | // @Override 19 | // protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | // String path = "/pages/errors.jsp";//定义错误页面 21 | // String status = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1); 22 | // //表示截取的最后一个字符串 23 | // if (status != null) { 24 | // if ("login".equals(status)) { 25 | // path = this.login(request); 26 | // } 27 | // } 28 | // 29 | // request.getRequestDispatcher(path).forward(request, response); 30 | // } 31 | // 32 | // /** 33 | // * 实现登录 34 | // * 35 | // * @param request 36 | // * @return 37 | // */ 38 | // public String login(HttpServletRequest request) { 39 | // String msg = "";//表示提示信息 40 | // String url = "";//表示跳转路径 41 | // String aid = request.getParameter("aid"); 42 | // String password = request.getParameter("password"); 43 | // //判断数据是否为空 44 | // if (ValidateUtils.validateEmpty(aid) && ValidateUtils.validateEmpty(password)) {//表示数据存在 45 | // 46 | // } else { 47 | // msg = "数据不能为空"; 48 | // url = "login.jsp"; 49 | // } 50 | // 51 | // return "/pages/forward.jsp"; 52 | // } 53 | //} 54 | // 55 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/vo/Admin.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.vo; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.Date; 5 | 6 | /** 7 | * @Authour:gsy 8 | * @Description: 9 | * @Date: 11:24 AM 2019/7/4 10 | */ 11 | public class Admin { 12 | 13 | private String aid; 14 | 15 | private String password; 16 | 17 | private Timestamp lastdate; 18 | 19 | private int flag; 20 | 21 | private int status; 22 | 23 | public String getAid() { 24 | return aid; 25 | } 26 | 27 | public void setAid(String aid) { 28 | this.aid = aid; 29 | } 30 | 31 | public String getPassword() { 32 | return password; 33 | } 34 | 35 | public void setPassword(String password) { 36 | this.password = password; 37 | } 38 | 39 | public Timestamp getLastdate() { 40 | return lastdate; 41 | } 42 | 43 | public void setLastdate(Timestamp lastdate) { 44 | this.lastdate = lastdate; 45 | } 46 | 47 | public int getFlag() { 48 | return flag; 49 | } 50 | 51 | public void setFlag(int flag) { 52 | this.flag = flag; 53 | } 54 | 55 | public int getStatus() { 56 | return status; 57 | } 58 | 59 | public void setStatus(int status) { 60 | this.status = status; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/vo/Books.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.vo; 2 | 3 | import java.awt.print.Book; 4 | import java.io.Serializable; 5 | import java.util.Date; 6 | import java.util.List; 7 | 8 | public class Books implements Serializable{ 9 | private Integer Bid; 10 | private String name; 11 | private Date credate; 12 | private String note; 13 | private Integer status; 14 | private Item item;//表示一本书属于一个类别 iid 15 | private Admin admin;//表示图书由谁增加,aid 16 | private List Lenbook;//表示可以借多本书 17 | 18 | public List getLenbook() { 19 | return Lenbook; 20 | } 21 | 22 | public void setLenbook(List lenbook) { 23 | Lenbook = lenbook; 24 | } 25 | 26 | public Integer getBid() { 27 | return Bid; 28 | } 29 | 30 | public void setBid(Integer bid) { 31 | Bid = bid; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | public Date getCredate() { 43 | return credate; 44 | } 45 | 46 | public void setCredate(Date credate) { 47 | this.credate = credate; 48 | } 49 | 50 | public String getNote() { 51 | return note; 52 | } 53 | 54 | public void setNote(String note) { 55 | this.note = note; 56 | } 57 | 58 | public Integer getStatus() { 59 | return status; 60 | } 61 | 62 | public void setStatus(Integer status) { 63 | this.status = status; 64 | } 65 | 66 | public Item getItem() { 67 | return item; 68 | } 69 | 70 | public void setItem(Item item) { 71 | this.item = item; 72 | } 73 | 74 | public Admin getAdmin() { 75 | return admin; 76 | } 77 | 78 | public void setAdmin(Admin admin) { 79 | this.admin = admin; 80 | } 81 | 82 | public void setBid(int bid) { 83 | this.Bid = bid; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/vo/Item.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.vo; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class Item implements Serializable{ 7 | private Integer iid; 8 | private String name; 9 | private String note; 10 | private List Book;//表示一个类别下有多本书 11 | 12 | public List getBook() { 13 | return Book; 14 | } 15 | 16 | public void setBook(List book) { 17 | Book = book; 18 | } 19 | public Integer getIid() { 20 | return iid; 21 | } 22 | 23 | public void setIid(Integer iid) { 24 | this.iid = iid; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public String getNote() { 36 | return note; 37 | } 38 | 39 | public void setNote(String note) { 40 | this.note = note; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/vo/Lenbook.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.vo; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class Lenbook implements Serializable { 7 | private Integer leid; 8 | private Books books;//表示图书编号 9 | private Member member;//表示用户id 10 | private Date credate;//借书日期 11 | 12 | public Integer getLeid() { 13 | return leid; 14 | } 15 | 16 | public void setLeid(Integer leid) { 17 | this.leid = leid; 18 | } 19 | 20 | public Books getBooks() { 21 | return books; 22 | } 23 | 24 | public void setBooks(Books books) { 25 | this.books = books; 26 | } 27 | 28 | public Member getMember() { 29 | return member; 30 | } 31 | 32 | public void setMember(Member menmber) { 33 | this.member = menmber; 34 | } 35 | 36 | public Date getCredate() { 37 | return credate; 38 | } 39 | 40 | public void setCredate(Date credate) { 41 | this.credate = credate; 42 | } 43 | 44 | public Date getRedate() { 45 | return redate; 46 | } 47 | 48 | public void setRedate(Date redate) { 49 | this.redate = redate; 50 | } 51 | 52 | private Date redate;//归还日期 53 | } 54 | -------------------------------------------------------------------------------- /src/cn/ylcto/book/vo/Member.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.book.vo; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class Member implements Serializable{ 7 | private String mid; 8 | private String name; 9 | private Integer age; 10 | private Integer sex; 11 | private String phone; 12 | private List Lenbooks; 13 | 14 | public List getLenbooks() { 15 | return Lenbooks; 16 | } 17 | 18 | public void setLenbooks(List lenbooks) { 19 | Lenbooks = lenbooks; 20 | } 21 | 22 | public String getGetMid() { 23 | return getMid; 24 | } 25 | 26 | public void setGetMid(String getMid) { 27 | this.getMid = getMid; 28 | } 29 | 30 | public String getMid; 31 | 32 | 33 | 34 | public String getMid() { 35 | return mid; 36 | } 37 | 38 | public void setMid(String aid) { 39 | this.mid = aid; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public Integer getAge() { 51 | return age; 52 | } 53 | 54 | public void setAge(Integer age) { 55 | this.age = age; 56 | } 57 | 58 | public Integer getSex() { 59 | return sex; 60 | } 61 | 62 | public void setSex(Integer sex) { 63 | this.sex = sex; 64 | } 65 | 66 | public String getPhone() { 67 | return phone; 68 | } 69 | 70 | public void setPhone(String phone) { 71 | this.phone = phone; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/cn/ylcto/util/MD5Code.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.util; 2 | 3 | public class MD5Code { 4 | /* 5 | * 下面这些S11-S44实际上是一个4*4的矩阵,在原始的C实现中是用#define 实现的, 这里把它们实现成为static 6 | * final是表示了只读,切能在同一个进程空间内的多个 Instance间共享 7 | */ 8 | static final int S11 = 7; 9 | 10 | static final int S12 = 12; 11 | 12 | static final int S13 = 17; 13 | 14 | static final int S14 = 22; 15 | 16 | static final int S21 = 5; 17 | 18 | static final int S22 = 9; 19 | 20 | static final int S23 = 14; 21 | 22 | static final int S24 = 20; 23 | 24 | static final int S31 = 4; 25 | 26 | static final int S32 = 11; 27 | 28 | static final int S33 = 16; 29 | 30 | static final int S34 = 23; 31 | 32 | static final int S41 = 6; 33 | 34 | static final int S42 = 10; 35 | 36 | static final int S43 = 15; 37 | 38 | static final int S44 = 21; 39 | 40 | static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43 | 0, 0, 0, 0, 0, 0, 0 }; 44 | 45 | /* 46 | * 下面的三个成员是MD5计算过程中用到的3个核心数据,在原始的C实现中 被定义到MD5_CTX结构中 47 | */ 48 | private long[] state = new long[4];// state (ABCD) 49 | 50 | private long[] count = new long[2];// number of bits, modulo 2^64 (lsb 51 | 52 | // first) 53 | 54 | private byte[] buffer = new byte[64]; // input buffer 55 | 56 | /* 57 | * digestHexStr是MD5的唯一一个公共成员,是最新一次计算结果的 16进制ASCII表示. 58 | */ 59 | 60 | public String digestHexStr; 61 | 62 | /* 63 | * digest,是最新一次计算结果的2进制内部表示,表示128bit的MD5值. 64 | */ 65 | private byte[] digest = new byte[16]; 66 | 67 | /* 68 | * getMD5ofStr是类MD5最主要的公共方法,入口参数是你想要进行MD5变换的字符串 69 | * 返回的是变换完的结果,这个结果是从公共成员digestHexStr取得的. 70 | */ 71 | public String getMD5ofStr(String inbuf) { 72 | md5Init(); 73 | md5Update(inbuf.getBytes(), inbuf.length()); 74 | md5Final(); 75 | digestHexStr = ""; 76 | for (int i = 0; i < 16; i++) { 77 | digestHexStr += byteHEX(digest[i]); 78 | } 79 | return digestHexStr; 80 | } 81 | 82 | // 这是MD5这个类的标准构造函数,JavaBean要求有一个public的并且没有参数的构造函数 83 | public MD5Code() { 84 | md5Init(); 85 | return; 86 | } 87 | 88 | /* md5Init是一个初始化函数,初始化核心变量,装入标准的幻数 */ 89 | private void md5Init() { 90 | count[0] = 0L; 91 | count[1] = 0L; 92 | // /* Load magic initialization constants. 93 | state[0] = 0x67452301L; 94 | state[1] = 0xefcdab89L; 95 | state[2] = 0x98badcfeL; 96 | state[3] = 0x10325476L; 97 | return; 98 | } 99 | 100 | /* 101 | * F, G, H ,I 是4个基本的MD5函数,在原始的MD5的C实现中,由于它们是 102 | * 简单的位运算,可能出于效率的考虑把它们实现成了宏,在java中,我们把它们 实现成了private方法,名字保持了原来C中的。 103 | */ 104 | private long F(long x, long y, long z) { 105 | return (x & y) | ((~x) & z); 106 | } 107 | 108 | private long G(long x, long y, long z) { 109 | return (x & z) | (y & (~z)); 110 | } 111 | 112 | private long H(long x, long y, long z) { 113 | return x ^ y ^ z; 114 | } 115 | 116 | private long I(long x, long y, long z) { 117 | return y ^ (x | (~z)); 118 | } 119 | 120 | /* 121 | * FF,GG,HH和II将调用F,G,H,I进行近一步变换 FF, GG, HH, and II transformations for 122 | * rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent 123 | * recomputation. 124 | */ 125 | private long FF(long a, long b, long c, long d, long x, long s, long ac) { 126 | a += F(b, c, d) + x + ac; 127 | a = ((int) a << s) | ((int) a >>> (32 - s)); 128 | a += b; 129 | return a; 130 | } 131 | 132 | private long GG(long a, long b, long c, long d, long x, long s, long ac) { 133 | a += G(b, c, d) + x + ac; 134 | a = ((int) a << s) | ((int) a >>> (32 - s)); 135 | a += b; 136 | return a; 137 | } 138 | 139 | private long HH(long a, long b, long c, long d, long x, long s, long ac) { 140 | a += H(b, c, d) + x + ac; 141 | a = ((int) a << s) | ((int) a >>> (32 - s)); 142 | a += b; 143 | return a; 144 | } 145 | 146 | private long II(long a, long b, long c, long d, long x, long s, long ac) { 147 | a += I(b, c, d) + x + ac; 148 | a = ((int) a << s) | ((int) a >>> (32 - s)); 149 | a += b; 150 | return a; 151 | } 152 | 153 | /* 154 | * md5Update是MD5的主计算过程,inbuf是要变换的字节串,inputlen是长度,这个 155 | * 函数由getMD5ofStr调用,调用之前需要调用md5init,因此把它设计成private的 156 | */ 157 | private void md5Update(byte[] inbuf, int inputLen) { 158 | int i, index, partLen; 159 | byte[] block = new byte[64]; 160 | index = (int) (count[0] >>> 3) & 0x3F; 161 | // /* Update number of bits */ 162 | if ((count[0] += (inputLen << 3)) < (inputLen << 3)) 163 | count[1]++; 164 | count[1] += (inputLen >>> 29); 165 | partLen = 64 - index; 166 | // Transform as many times as possible. 167 | if (inputLen >= partLen) { 168 | md5Memcpy(buffer, inbuf, index, 0, partLen); 169 | md5Transform(buffer); 170 | for (i = partLen; i + 63 < inputLen; i += 64) { 171 | md5Memcpy(block, inbuf, 0, i, 64); 172 | md5Transform(block); 173 | } 174 | index = 0; 175 | } else 176 | i = 0; 177 | // /* Buffer remaining input */ 178 | md5Memcpy(buffer, inbuf, index, i, inputLen - i); 179 | } 180 | 181 | /* 182 | * md5Final整理和填写输出结果 183 | */ 184 | private void md5Final() { 185 | byte[] bits = new byte[8]; 186 | int index, padLen; 187 | // /* Save number of bits */ 188 | Encode(bits, count, 8); 189 | // /* Pad out to 56 mod 64. 190 | index = (int) (count[0] >>> 3) & 0x3f; 191 | padLen = (index < 56) ? (56 - index) : (120 - index); 192 | md5Update(PADDING, padLen); 193 | // /* Append length (before padding) */ 194 | md5Update(bits, 8); 195 | // /* Store state in digest */ 196 | Encode(digest, state, 16); 197 | } 198 | 199 | /* 200 | * md5Memcpy是一个内部使用的byte数组的块拷贝函数,从input的inpos开始把len长度的 201 | * 字节拷贝到output的outpos位置开始 202 | */ 203 | private void md5Memcpy(byte[] output, byte[] input, int outpos, int inpos, 204 | int len) { 205 | int i; 206 | for (i = 0; i < len; i++) 207 | output[outpos + i] = input[inpos + i]; 208 | } 209 | 210 | /* 211 | * md5Transform是MD5核心变换程序,有md5Update调用,block是分块的原始字节 212 | */ 213 | private void md5Transform(byte block[]) { 214 | long a = state[0], b = state[1], c = state[2], d = state[3]; 215 | long[] x = new long[16]; 216 | Decode(x, block, 64); 217 | /* Round 1 */ 218 | a = FF(a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */ 219 | d = FF(d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */ 220 | c = FF(c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */ 221 | b = FF(b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */ 222 | a = FF(a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */ 223 | d = FF(d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */ 224 | c = FF(c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */ 225 | b = FF(b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */ 226 | a = FF(a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */ 227 | d = FF(d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */ 228 | c = FF(c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */ 229 | b = FF(b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */ 230 | a = FF(a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */ 231 | d = FF(d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */ 232 | c = FF(c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */ 233 | b = FF(b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */ 234 | /* Round 2 */ 235 | a = GG(a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */ 236 | d = GG(d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */ 237 | c = GG(c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */ 238 | b = GG(b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */ 239 | a = GG(a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */ 240 | d = GG(d, a, b, c, x[10], S22, 0x2441453L); /* 22 */ 241 | c = GG(c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */ 242 | b = GG(b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */ 243 | a = GG(a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */ 244 | d = GG(d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */ 245 | c = GG(c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */ 246 | b = GG(b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */ 247 | a = GG(a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */ 248 | d = GG(d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */ 249 | c = GG(c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */ 250 | b = GG(b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */ 251 | /* Round 3 */ 252 | a = HH(a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */ 253 | d = HH(d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */ 254 | c = HH(c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */ 255 | b = HH(b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */ 256 | a = HH(a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */ 257 | d = HH(d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */ 258 | c = HH(c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */ 259 | b = HH(b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */ 260 | a = HH(a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */ 261 | d = HH(d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */ 262 | c = HH(c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */ 263 | b = HH(b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */ 264 | a = HH(a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */ 265 | d = HH(d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */ 266 | c = HH(c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */ 267 | b = HH(b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */ 268 | /* Round 4 */ 269 | a = II(a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */ 270 | d = II(d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */ 271 | c = II(c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */ 272 | b = II(b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */ 273 | a = II(a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */ 274 | d = II(d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */ 275 | c = II(c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */ 276 | b = II(b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */ 277 | a = II(a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */ 278 | d = II(d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */ 279 | c = II(c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */ 280 | b = II(b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */ 281 | a = II(a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */ 282 | d = II(d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */ 283 | c = II(c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */ 284 | b = II(b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */ 285 | state[0] += a; 286 | state[1] += b; 287 | state[2] += c; 288 | state[3] += d; 289 | } 290 | 291 | /* 292 | * Encode把long数组按顺序拆成byte数组,因为java的long类型是64bit的, 只拆低32bit,以适应原始C实现的用途 293 | */ 294 | private void Encode(byte[] output, long[] input, int len) { 295 | int i, j; 296 | for (i = 0, j = 0; j < len; i++, j += 4) { 297 | output[j] = (byte) (input[i] & 0xffL); 298 | output[j + 1] = (byte) ((input[i] >>> 8) & 0xffL); 299 | output[j + 2] = (byte) ((input[i] >>> 16) & 0xffL); 300 | output[j + 3] = (byte) ((input[i] >>> 24) & 0xffL); 301 | } 302 | } 303 | 304 | /* 305 | * Decode把byte数组按顺序合成成long数组,因为java的long类型是64bit的, 306 | * 只合成低32bit,高32bit清零,以适应原始C实现的用途 307 | */ 308 | private void Decode(long[] output, byte[] input, int len) { 309 | int i, j; 310 | for (i = 0, j = 0; j < len; i++, j += 4) 311 | output[i] = b2iu(input[j]) | (b2iu(input[j + 1]) << 8) 312 | | (b2iu(input[j + 2]) << 16) | (b2iu(input[j + 3]) << 24); 313 | return; 314 | } 315 | 316 | /* 317 | * b2iu是我写的一个把byte按照不考虑正负号的原则的"升位"程序,因为java没有unsigned运算 318 | */ 319 | public static long b2iu(byte b) { 320 | return b < 0 ? b & 0x7F + 128 : b; 321 | } 322 | 323 | /* 324 | * byteHEX(),用来把一个byte类型的数转换成十六进制的ASCII表示, 325 | * 因为java中的byte的toString无法实现这一点,我们又没有C语言中的 sprintf(outbuf,"%02X",ib) 326 | */ 327 | public static String byteHEX(byte ib) { 328 | char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 329 | 'B', 'C', 'D', 'E', 'F' }; 330 | char[] ob = new char[2]; 331 | ob[0] = Digit[(ib >>> 4) & 0X0F]; 332 | ob[1] = Digit[ib & 0X0F]; 333 | String s = new String(ob); 334 | return s; 335 | } 336 | } 337 | -------------------------------------------------------------------------------- /src/cn/ylcto/util/filter/EncodingFilter.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.util.filter; 2 | 3 | import javax.servlet.*; 4 | import javax.servlet.annotation.WebFilter; 5 | import java.io.IOException; 6 | import java.util.Date; 7 | import java.util.logging.Filter; 8 | import java.util.logging.LogRecord; 9 | 10 | @WebFilter(filterName = "EncodingFilter",urlPatterns = "/*") 11 | public class EncodingFilter implements Filter { 12 | @Override 13 | public void init(FilterConfig filterConfig) throws ServletException { 14 | 15 | } 16 | 17 | @Override 18 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 19 | servletRequest.setCharacterEncoding("UTF-8"); 20 | filterChain.doFilter(servletRequest,servletResponse); 21 | servletResponse.setCharacterEncoding("UTF-8"); 22 | Date begin = new Date(); 23 | begin.getTime(); 24 | } 25 | 26 | @Override 27 | public void destroy() { 28 | 29 | } 30 | 31 | @Override 32 | public boolean isLoggable(LogRecord record) { 33 | return false; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/cn/ylcto/util/test/AbstractDAOImpl.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.util.test; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | public class AbstractDAOImpl { 7 | protected Connection conn; 8 | protected PreparedStatement pstmt; 9 | //定义一个构造方法 10 | public AbstractDAOImpl(Connection conn){ 11 | this.conn = conn; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/cn/ylcto/util/validate/ValidateUtils.java: -------------------------------------------------------------------------------- 1 | package cn.ylcto.util.validate; 2 | 3 | public class ValidateUtils { 4 | 5 | public static boolean validateEmpty(String data){ 6 | if(data == null||"".equals(data)){ 7 | return false; 8 | } 9 | 10 | return true;//很关键!! 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /web/WEB-INF/c.tld: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 48 | 49 | JSTL 1.2 core library 50 | JSTL core 51 | 1.2 52 | c 53 | http://java.sun.com/jsp/jstl/core 54 | 55 | 56 | 57 | Provides core validation features for JSTL tags. 58 | 59 | 60 | org.apache.taglibs.standard.tlv.JstlCoreTLV 61 | 62 | 63 | 64 | 65 | 66 | Catches any Throwable that occurs in its body and optionally 67 | exposes it. 68 | 69 | catch 70 | org.apache.taglibs.standard.tag.common.core.CatchTag 71 | JSP 72 | 73 | 74 | Name of the exported scoped variable for the 75 | exception thrown from a nested action. The type of the 76 | scoped variable is the type of the exception thrown. 77 | 78 | var 79 | false 80 | false 81 | 82 | 83 | 84 | 85 | 86 | Simple conditional tag that establishes a context for 87 | mutually exclusive conditional operations, marked by 88 | <when> and <otherwise> 89 | 90 | choose 91 | org.apache.taglibs.standard.tag.common.core.ChooseTag 92 | JSP 93 | 94 | 95 | 96 | 97 | Simple conditional tag, which evalutes its body if the 98 | supplied condition is true and optionally exposes a Boolean 99 | scripting variable representing the evaluation of this condition 100 | 101 | if 102 | org.apache.taglibs.standard.tag.rt.core.IfTag 103 | JSP 104 | 105 | 106 | The test condition that determines whether or 107 | not the body content should be processed. 108 | 109 | test 110 | true 111 | true 112 | boolean 113 | 114 | 115 | 116 | Name of the exported scoped variable for the 117 | resulting value of the test condition. The type 118 | of the scoped variable is Boolean. 119 | 120 | var 121 | false 122 | false 123 | 124 | 125 | 126 | Scope for var. 127 | 128 | scope 129 | false 130 | false 131 | 132 | 133 | 134 | 135 | 136 | Retrieves an absolute or relative URL and exposes its contents 137 | to either the page, a String in 'var', or a Reader in 'varReader'. 138 | 139 | import 140 | org.apache.taglibs.standard.tag.rt.core.ImportTag 141 | org.apache.taglibs.standard.tei.ImportTEI 142 | JSP 143 | 144 | 145 | The URL of the resource to import. 146 | 147 | url 148 | true 149 | true 150 | 151 | 152 | 153 | Name of the exported scoped variable for the 154 | resource's content. The type of the scoped 155 | variable is String. 156 | 157 | var 158 | false 159 | false 160 | 161 | 162 | 163 | Scope for var. 164 | 165 | scope 166 | false 167 | false 168 | 169 | 170 | 171 | Name of the exported scoped variable for the 172 | resource's content. The type of the scoped 173 | variable is Reader. 174 | 175 | varReader 176 | false 177 | false 178 | 179 | 180 | 181 | Name of the context when accessing a relative 182 | URL resource that belongs to a foreign 183 | context. 184 | 185 | context 186 | false 187 | true 188 | 189 | 190 | 191 | Character encoding of the content at the input 192 | resource. 193 | 194 | charEncoding 195 | false 196 | true 197 | 198 | 199 | 200 | 201 | 202 | The basic iteration tag, accepting many different 203 | collection types and supporting subsetting and other 204 | functionality 205 | 206 | forEach 207 | org.apache.taglibs.standard.tag.rt.core.ForEachTag 208 | org.apache.taglibs.standard.tei.ForEachTEI 209 | JSP 210 | 211 | 212 | Collection of items to iterate over. 213 | 214 | items 215 | false 216 | true 217 | java.lang.Object 218 | 219 | java.lang.Object 220 | 221 | 222 | 223 | 224 | If items specified: 225 | Iteration begins at the item located at the 226 | specified index. First item of the collection has 227 | index 0. 228 | If items not specified: 229 | Iteration begins with index set at the value 230 | specified. 231 | 232 | begin 233 | false 234 | true 235 | int 236 | 237 | 238 | 239 | If items specified: 240 | Iteration ends at the item located at the 241 | specified index (inclusive). 242 | If items not specified: 243 | Iteration ends when index reaches the value 244 | specified. 245 | 246 | end 247 | false 248 | true 249 | int 250 | 251 | 252 | 253 | Iteration will only process every step items of 254 | the collection, starting with the first one. 255 | 256 | step 257 | false 258 | true 259 | int 260 | 261 | 262 | 263 | Name of the exported scoped variable for the 264 | current item of the iteration. This scoped 265 | variable has nested visibility. Its type depends 266 | on the object of the underlying collection. 267 | 268 | var 269 | false 270 | false 271 | 272 | 273 | 274 | Name of the exported scoped variable for the 275 | status of the iteration. Object exported is of type 276 | javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested 277 | visibility. 278 | 279 | varStatus 280 | false 281 | false 282 | 283 | 284 | 285 | 286 | 287 | Iterates over tokens, separated by the supplied delimeters 288 | 289 | forTokens 290 | org.apache.taglibs.standard.tag.rt.core.ForTokensTag 291 | JSP 292 | 293 | 294 | String of tokens to iterate over. 295 | 296 | items 297 | true 298 | true 299 | java.lang.String 300 | 301 | java.lang.String 302 | 303 | 304 | 305 | 306 | The set of delimiters (the characters that 307 | separate the tokens in the string). 308 | 309 | delims 310 | true 311 | true 312 | java.lang.String 313 | 314 | 315 | 316 | Iteration begins at the token located at the 317 | specified index. First token has index 0. 318 | 319 | begin 320 | false 321 | true 322 | int 323 | 324 | 325 | 326 | Iteration ends at the token located at the 327 | specified index (inclusive). 328 | 329 | end 330 | false 331 | true 332 | int 333 | 334 | 335 | 336 | Iteration will only process every step tokens 337 | of the string, starting with the first one. 338 | 339 | step 340 | false 341 | true 342 | int 343 | 344 | 345 | 346 | Name of the exported scoped variable for the 347 | current item of the iteration. This scoped 348 | variable has nested visibility. 349 | 350 | var 351 | false 352 | false 353 | 354 | 355 | 356 | Name of the exported scoped variable for the 357 | status of the iteration. Object exported is of 358 | type 359 | javax.servlet.jsp.jstl.core.LoopTag 360 | Status. This scoped variable has nested 361 | visibility. 362 | 363 | varStatus 364 | false 365 | false 366 | 367 | 368 | 369 | 370 | 371 | Like <%= ... >, but for expressions. 372 | 373 | out 374 | org.apache.taglibs.standard.tag.rt.core.OutTag 375 | JSP 376 | 377 | 378 | Expression to be evaluated. 379 | 380 | value 381 | true 382 | true 383 | 384 | 385 | 386 | Default value if the resulting value is null. 387 | 388 | default 389 | false 390 | true 391 | 392 | 393 | 394 | Determines whether characters <,>,&,'," in the 395 | resulting string should be converted to their 396 | corresponding character entity codes. Default value is 397 | true. 398 | 399 | escapeXml 400 | false 401 | true 402 | 403 | 404 | 405 | 406 | 407 | 408 | Subtag of <choose> that follows <when> tags 409 | and runs only if all of the prior conditions evaluated to 410 | 'false' 411 | 412 | otherwise 413 | org.apache.taglibs.standard.tag.common.core.OtherwiseTag 414 | JSP 415 | 416 | 417 | 418 | 419 | Adds a parameter to a containing 'import' tag's URL. 420 | 421 | param 422 | org.apache.taglibs.standard.tag.rt.core.ParamTag 423 | JSP 424 | 425 | 426 | Name of the query string parameter. 427 | 428 | name 429 | true 430 | true 431 | 432 | 433 | 434 | Value of the parameter. 435 | 436 | value 437 | false 438 | true 439 | 440 | 441 | 442 | 443 | 444 | Redirects to a new URL. 445 | 446 | redirect 447 | org.apache.taglibs.standard.tag.rt.core.RedirectTag 448 | JSP 449 | 450 | 451 | The URL of the resource to redirect to. 452 | 453 | url 454 | false 455 | true 456 | 457 | 458 | 459 | Name of the context when redirecting to a relative URL 460 | resource that belongs to a foreign context. 461 | 462 | context 463 | false 464 | true 465 | 466 | 467 | 468 | 469 | 470 | Removes a scoped variable (from a particular scope, if specified). 471 | 472 | remove 473 | org.apache.taglibs.standard.tag.common.core.RemoveTag 474 | empty 475 | 476 | 477 | Name of the scoped variable to be removed. 478 | 479 | var 480 | true 481 | false 482 | 483 | 484 | 485 | Scope for var. 486 | 487 | scope 488 | false 489 | false 490 | 491 | 492 | 493 | 494 | 495 | Sets the result of an expression evaluation in a 'scope' 496 | 497 | set 498 | org.apache.taglibs.standard.tag.rt.core.SetTag 499 | JSP 500 | 501 | 502 | Name of the exported scoped variable to hold the value 503 | specified in the action. The type of the scoped variable is 504 | whatever type the value expression evaluates to. 505 | 506 | var 507 | false 508 | false 509 | 510 | 511 | 512 | Expression to be evaluated. 513 | 514 | value 515 | false 516 | true 517 | 518 | java.lang.Object 519 | 520 | 521 | 522 | 523 | Target object whose property will be set. Must evaluate to 524 | a JavaBeans object with setter property property, or to a 525 | java.util.Map object. 526 | 527 | target 528 | false 529 | true 530 | 531 | 532 | 533 | Name of the property to be set in the target object. 534 | 535 | property 536 | false 537 | true 538 | 539 | 540 | 541 | Scope for var. 542 | 543 | scope 544 | false 545 | false 546 | 547 | 548 | 549 | 550 | 551 | Creates a URL with optional query parameters. 552 | 553 | url 554 | org.apache.taglibs.standard.tag.rt.core.UrlTag 555 | JSP 556 | 557 | 558 | Name of the exported scoped variable for the 559 | processed url. The type of the scoped variable is 560 | String. 561 | 562 | var 563 | false 564 | false 565 | 566 | 567 | 568 | Scope for var. 569 | 570 | scope 571 | false 572 | false 573 | 574 | 575 | 576 | URL to be processed. 577 | 578 | value 579 | false 580 | true 581 | 582 | 583 | 584 | Name of the context when specifying a relative URL 585 | resource that belongs to a foreign context. 586 | 587 | context 588 | false 589 | true 590 | 591 | 592 | 593 | 594 | 595 | Subtag of <choose> that includes its body if its 596 | condition evalutes to 'true' 597 | 598 | when 599 | org.apache.taglibs.standard.tag.rt.core.WhenTag 600 | JSP 601 | 602 | 603 | The test condition that determines whether or not the 604 | body content should be processed. 605 | 606 | test 607 | true 608 | true 609 | boolean 610 | 611 | 612 | 613 | 614 | -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | http://www.ylcto.cn/c 10 | /WEB-INF/c.tld 11 | 12 | 13 | 14 | 15 | /login.jsp 16 | 17 | -------------------------------------------------------------------------------- /web/YF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/YF.png -------------------------------------------------------------------------------- /web/assets/css/basic.css: -------------------------------------------------------------------------------- 1 | 2 | /*============================================== 3 | BASIC STYLES 4 | =============================================*/ 5 | body { 6 | font-family: 'Open Sans', sans-serif; 7 | line-height:25px; 8 | } 9 | 10 | #wrapper { 11 | width: 100%; 12 | background: #202020; 13 | } 14 | 15 | #page-wrapper { 16 | padding: 15px 15px; 17 | min-height: 100px; 18 | background: #F3F3F3; 19 | } 20 | 21 | #page-inner { 22 | width: 100%; 23 | margin: 10px 20px 10px 0px; 24 | background-color: #fff!important; 25 | padding: 10px; 26 | min-height: 800px; 27 | } 28 | 29 | .page-head-line { 30 | font-size: 30px; 31 | text-transform: uppercase; 32 | color: #000; 33 | font-weight: 800; 34 | padding-bottom: 20px; 35 | border-bottom: 2px solid #00CA79; 36 | margin-bottom: 10px; 37 | } 38 | 39 | .page-subhead-line { 40 | font-size: 14px; 41 | padding-top: 5px; 42 | padding-bottom: 20px; 43 | font-style:italic; 44 | margin-bottom:30px; 45 | border-bottom:1px dashed #00CA79; 46 | 47 | } 48 | 49 | .copyrights{ 50 | text-indent:-9999px; 51 | height:0; 52 | line-height:0; 53 | font-size:0; 54 | overflow:hidden; 55 | } 56 | /*============================================== 57 | MENU STYLES 58 | =============================================*/ 59 | 60 | 61 | .navbar-cls-top .navbar-brand { 62 | color: #fff; 63 | background: #202020; 64 | width: 260px; 65 | text-align: center; 66 | height: 75px; 67 | font-size: 20px; 68 | letter-spacing: 1px; 69 | font-weight: 900; 70 | padding-top: 25px; 71 | text-transform:uppercase; 72 | } 73 | 74 | .header-right { 75 | color: #fff; 76 | padding: 15px 50px 5px 50px; 77 | float: right; 78 | font-size: 16px; 79 | } 80 | 81 | .navbar-cls-top .navbar-brand:hover { 82 | background: #202020; 83 | color: #fff; 84 | } 85 | 86 | .user-img-div { 87 | min-height: 140px; 88 | padding: 20px; 89 | background-color: #4380B8; 90 | } 91 | 92 | .user-img-div img { 93 | max-height: 60px; 94 | } 95 | 96 | .user-img-div .inner-text { 97 | text-align: right; 98 | position: relative; 99 | color: #fff; 100 | font-weight: 800; 101 | line-height: 25px; 102 | } 103 | 104 | .active-menu { 105 | background-color: #00CA79!important; 106 | } 107 | .active-menu-top { 108 | background-color: #000!important; 109 | } 110 | 111 | .arrow { 112 | float: right; 113 | } 114 | 115 | .fa.arrow:before { 116 | content: "\f104"; 117 | } 118 | 119 | .active > a > .fa.arrow:before { 120 | content: "\f107"; 121 | } 122 | 123 | 124 | .nav-second-level li, 125 | .nav-third-level li { 126 | border-bottom: none !important; 127 | } 128 | 129 | .nav-second-level li a { 130 | padding-left: 37px; 131 | } 132 | 133 | .nav-third-level li a { 134 | padding-left: 55px; 135 | } 136 | 137 | .sidebar-collapse, .sidebar-collapse .nav { 138 | background: none; 139 | } 140 | 141 | .sidebar-collapse .nav { 142 | padding: 0; 143 | } 144 | 145 | .sidebar-collapse .nav > li > a { 146 | color: #fff; 147 | background: #202020; 148 | text-shadow: none; 149 | padding: 15px 40px; 150 | border-bottom: 1px solid #2F2E31; 151 | } 152 | 153 | .sidebar-collapse > .nav > li > a { 154 | padding: 15px 10px; 155 | } 156 | 157 | .sidebar-collapse .nav > li > a:hover, 158 | .sidebar-collapse .nav > li > a:focus { 159 | background: #0A0A0A; 160 | outline: 0; 161 | } 162 | 163 | 164 | 165 | .nav-second-level > li:last-child > a:after, 166 | .nav-third-level > li:last-child > a:after { 167 | height: 50%; 168 | } 169 | 170 | .nav-third-level > li > a:after, 171 | .nav-third-level > li > a:before { 172 | left: 40px; 173 | } 174 | 175 | .navbar-side { 176 | border: none; 177 | background-color: #202020; 178 | } 179 | 180 | .navbar-cls-top { 181 | background: #00CA79; 182 | border-bottom: none; 183 | } 184 | 185 | 186 | .navbar-default { 187 | border: 0px solid black; 188 | } 189 | 190 | .navbar-header { 191 | background: #000000; 192 | } 193 | 194 | .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { 195 | background-color: #00CA79; 196 | } 197 | 198 | .navbar-default .navbar-toggle { 199 | border-color: #fff; 200 | } 201 | 202 | .navbar-default .navbar-toggle .icon-bar { 203 | background-color: #FFF; 204 | } 205 | 206 | .nav > li > a > i { 207 | margin-right: 10px; 208 | } 209 | /*============================================== 210 | FOOTER STYLES 211 | =============================================*/ 212 | #footer-sec { 213 | background-color:#000; 214 | padding:20px 50px; 215 | color:#fff; 216 | font-size:12px; 217 | } 218 | 219 | #footer-sec a { 220 | color:#fff; 221 | } 222 | #footer-sec a:hover,a:focus { 223 | color:#fff; 224 | text-decoration:none; 225 | } 226 | /*============================================== 227 | MEDIA QUERIES 228 | =============================================*/ 229 | 230 | @media (min-width:768px) { 231 | #page-wrapper { 232 | margin: 0 0 0 260px; 233 | padding: 15px 30px; 234 | min-height: 300px; 235 | } 236 | 237 | 238 | .navbar-side { 239 | z-index: 1; 240 | position: absolute; 241 | width: 260px; 242 | } 243 | 244 | .navbar { 245 | border-radius: 0px; 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /web/assets/css/custom.css: -------------------------------------------------------------------------------- 1 |  2 | 3 | /*============================================== 4 | MAIN BOX STYLES 5 | =============================================*/ 6 | .main-box { 7 | text-align:center; 8 | padding:20px; 9 | border-radius:5px; 10 | -moz-border-radius:5px ; 11 | -webkit-border-radius:5px; 12 | margin-bottom:40px; 13 | } 14 | .main-box a,.main-box a:hover { 15 | color:#fff; 16 | text-decoration:none; 17 | 18 | } 19 | .mb-dull { 20 | background-color:#8F8F2C; 21 | } 22 | .mb-red { 23 | background-color:#d36f2e; 24 | } 25 | .mb-pink { 26 | background-color:#FF2F71; 27 | } 28 | .main-box h5 { 29 | font-size:16px; 30 | font-weight:800; 31 | text-transform:uppercase; 32 | } 33 | /*============================================== 34 | CHAT WINDOW STYLES 35 | =============================================*/ 36 | 37 | .chat-widget-main { 38 | max-height:500px; 39 | padding:20px; 40 | overflow:auto; 41 | } 42 | .chat-widget-left:after { 43 | top: 100%; 44 | left: 10%; 45 | border: solid transparent; 46 | content: " "; 47 | position: absolute; 48 | border-top-color: #6792d5; 49 | border-width: 15px; 50 | margin-left: -15px; 51 | 52 | } 53 | 54 | .chat-widget-left { 55 | width: 100%; 56 | height: auto; 57 | padding: 15px; 58 | -webkit-border-radius: 5px; 59 | -moz-border-radius: 5px; 60 | border-radius: 5px; 61 | position: relative; 62 | border: 1px solid #6792d5; 63 | font-size:14px; 64 | 65 | } 66 | .chat-widget-right:after { 67 | top: 100%; 68 | right: 10%; 69 | border: solid transparent; 70 | content: " "; 71 | position: absolute; 72 | border-top-color: #d51111; 73 | border-width: 15px; 74 | margin-left: -15px; 75 | } 76 | 77 | .chat-widget-right { 78 | width: 100%; 79 | height: auto; 80 | padding: 15px; 81 | -webkit-border-radius: 5px; 82 | -moz-border-radius: 5px; 83 | border-radius: 5px; 84 | position: relative; 85 | border: 1px solid #d51111; 86 | font-size:14px; 87 | 88 | } 89 | 90 | .chat-widget-name-left { 91 | color: #6792d5; 92 | margin-top: 30px; 93 | margin-left: 60px; 94 | text-align:left; 95 | font-weight:900; 96 | padding-bottom:20px; 97 | font-size:16px; 98 | } 99 | .chat-widget-name-right { 100 | color: #d51111; 101 | margin-top: 30px; 102 | margin-right: 60px; 103 | font-size:16px; 104 | text-align:right; 105 | font-weight:900; 106 | padding-bottom:20px; 107 | 108 | 109 | } 110 | 111 | /*============================================== 112 | Reviews Styles 113 | =============================================*/ 114 | #reviews { 115 | min-height:180px; 116 | background-color:#64A2DB; 117 | padding:15px; 118 | } 119 | #reviews h4 { 120 | color: #fff; 121 | line-height: 30px; 122 | font-size: 16px; 123 | } 124 | #reviews .user-img { 125 | border: 2px solid #fff; 126 | overflow: hidden; 127 | border-radius: 50%; 128 | display: inline-block; 129 | } 130 | 131 | #reviews .img-u { 132 | max-height: 90px; 133 | max-width: 90px; 134 | } 135 | 136 | #reviews .c-black { 137 | color:#fff; 138 | font-style: italic; 139 | font-size: 20px; 140 | padding: 5px; 141 | } 142 | 143 | /*============================================== 144 | NOTICE BOX STYLES 145 | =============================================*/ 146 | 147 | .noti-box { 148 | min-height: 100px; 149 | color:#fff; 150 | padding: 20px; 151 | } 152 | .noti-box .icon-box { 153 | display: block; 154 | float: left; 155 | margin: 0 15px 10px 0; 156 | width: 70px; 157 | height: 70px; 158 | line-height: 75px; 159 | vertical-align: middle; 160 | text-align: center; 161 | font-size: 40px; 162 | } 163 | .bg-color-black { 164 | background-color: #424242; 165 | color: #fff; 166 | } 167 | .main-text { 168 | font-size: 25px; 169 | font-weight: 600; 170 | } 171 | .color-bottom-txt { 172 | font-size: 16px; 173 | line-height: 30px; 174 | } 175 | .panel-back { 176 | background-color: #929292; 177 | } 178 | 179 | /*========================================== 180 | GALLERY/ PORTFOLIO STYLES 181 | =====================================================*/ 182 | 183 | #port-folio { 184 | padding-top: 10px; 185 | padding-bottom: 100px; 186 | } 187 | .portfolio-item { 188 | border:1px solid #000; 189 | margin:3px; 190 | } 191 | .portfolio-item p { 192 | padding:12px; 193 | color:#fff; 194 | line-height:25px; 195 | } 196 | 197 | .portfolio-item .overlay { 198 | 199 | background-color: #000; 200 | text-align: center; 201 | padding-bottom:30px; 202 | 203 | } 204 | 205 | /*========================================== 206 | GALLERY/ PORTFOLIO FILTER STYLES 207 | =====================================================*/ 208 | ul#filters { 209 | padding: 0px; 210 | } 211 | #filters { 212 | margin: 3% 0; 213 | padding: 0; 214 | list-style: none; 215 | text-align: center; 216 | } 217 | #filters li { 218 | display: -webkit-inline-box; 219 | } 220 | #filters li span { 221 | display: block; 222 | padding: 5px 4px; 223 | text-decoration: none; 224 | color: #d51111; 225 | cursor: pointer; 226 | font-size: 18px; 227 | } 228 | #port-folio .portfolio-item { 229 | -webkit-box-sizing: border-box; 230 | -moz-box-sizing: border-box; 231 | -o-box-sizing: border-box; 232 | width: 100%; 233 | opacity:.2; 234 | float:left; 235 | overflow:hidden; 236 | } 237 | 238 | -------------------------------------------------------------------------------- /web/assets/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /web/assets/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /web/assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /web/assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /web/assets/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /web/assets/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /web/assets/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /web/assets/img/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/web/assets/img/user.png -------------------------------------------------------------------------------- /web/assets/js/custom.js: -------------------------------------------------------------------------------- 1 |  2 | /*============================================================= 3 | Authour URI: # 4 | License: Commons Attribution 3.0 5 | 6 | http://creativecommons.org/licenses/by/3.0/ 7 | 8 | 100% To use For Personal And Commercial Use. 9 | IN EXCHANGE JUST GIVE US CREDITS AND TELL YOUR FRIENDS ABOUT US 10 | 11 | ======================================================== */ 12 | 13 | 14 | (function ($) { 15 | "use strict"; 16 | var mainApp = { 17 | 18 | metisMenu: function () { 19 | 20 | /*==================================== 21 | METIS MENU 22 | ======================================*/ 23 | 24 | $('#main-menu').metisMenu(); 25 | 26 | }, 27 | 28 | 29 | loadMenu: function () { 30 | 31 | /*==================================== 32 | LOAD APPROPRIATE MENU BAR 33 | ======================================*/ 34 | 35 | $(window).bind("load resize", function () { 36 | if ($(this).width() < 768) { 37 | $('div.sidebar-collapse').addClass('collapse') 38 | } else { 39 | $('div.sidebar-collapse').removeClass('collapse') 40 | } 41 | }); 42 | }, 43 | slide_show: function () { 44 | 45 | /*==================================== 46 | SLIDESHOW SCRIPTS 47 | ======================================*/ 48 | 49 | $('#carousel-example').carousel({ 50 | interval: 3000 // THIS TIME IS IN MILLI SECONDS 51 | }) 52 | }, 53 | reviews_fun: function () { 54 | /*==================================== 55 | REWIEW SLIDE SCRIPTS 56 | ======================================*/ 57 | $('#reviews').carousel({ 58 | interval: 2000 //TIME IN MILLI SECONDS 59 | }) 60 | }, 61 | wizard_fun: function () { 62 | /*==================================== 63 | //horizontal wizrd code section 64 | ======================================*/ 65 | $(function () { 66 | $("#wizard").steps({ 67 | headerTag: "h2", 68 | bodyTag: "section", 69 | transitionEffect: "slideLeft" 70 | }); 71 | }); 72 | /*==================================== 73 | //vertical wizrd code section 74 | ======================================*/ 75 | $(function () { 76 | $("#wizardV").steps({ 77 | headerTag: "h2", 78 | bodyTag: "section", 79 | transitionEffect: "slideLeft", 80 | stepsOrientation: "vertical" 81 | }); 82 | }); 83 | }, 84 | 85 | 86 | }; 87 | $(document).ready(function () { 88 | mainApp.metisMenu(); 89 | mainApp.loadMenu(); 90 | mainApp.slide_show(); 91 | mainApp.reviews_fun(); 92 | mainApp.wizard_fun(); 93 | 94 | }); 95 | }(jQuery)); -------------------------------------------------------------------------------- /web/assets/js/jquery.metisMenu.js: -------------------------------------------------------------------------------- 1 | ;(function ($, window, document, undefined) { 2 | 3 | var pluginName = "metisMenu", 4 | defaults = { 5 | toggle: true 6 | }; 7 | 8 | function Plugin(element, options) { 9 | this.element = element; 10 | this.settings = $.extend({}, defaults, options); 11 | this._defaults = defaults; 12 | this._name = pluginName; 13 | this.init(); 14 | } 15 | 16 | Plugin.prototype = { 17 | init: function () { 18 | 19 | var $this = $(this.element), 20 | $toggle = this.settings.toggle; 21 | 22 | $this.find('li.active').has('ul').children('ul').addClass('collapse in'); 23 | $this.find('li').not('.active').has('ul').children('ul').addClass('collapse'); 24 | 25 | $this.find('li').has('ul').children('a').on('click', function (e) { 26 | e.preventDefault(); 27 | 28 | $(this).parent('li').toggleClass('active').children('ul').collapse('toggle'); 29 | 30 | if ($toggle) { 31 | $(this).parent('li').siblings().removeClass('active').children('ul.in').collapse('hide'); 32 | } 33 | }); 34 | } 35 | }; 36 | 37 | $.fn[ pluginName ] = function (options) { 38 | return this.each(function () { 39 | if (!$.data(this, "plugin_" + pluginName)) { 40 | $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 41 | } 42 | }); 43 | }; 44 | 45 | })(jQuery, window, document); 46 | -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: gsy 4 | Date: 2018/2/6 5 | Time: 22:32 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | $Title$ 12 | 13 | 14 |

登录成功

15 | 16 | 17 | -------------------------------------------------------------------------------- /web/kong.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: gsy 4 | Date: 2018/2/16 5 | Time: 22:09 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 输入为空--页面 12 | 13 | 14 |

对不起,您的输入为空

15 | 16 | 17 | -------------------------------------------------------------------------------- /web/login.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html; charset=UTF-8" language="java" %> 2 | 3 | 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme()+"://" 7 | +request.getServerName()+":"+request.getServerPort() 8 | +path+"/"; 9 | %> 10 | 11 | 12 | 13 | YF图书管理系统 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 |
28 |

YF图书管理系统

29 |
30 |
31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 |
Enter Details to Login
39 |
40 |
41 | 42 | 43 |
44 |
45 | 46 | 47 |
48 | 49 | 50 |
51 | 忘记密码 ? 点击这里 或者联系QQ: 1007691667 52 |
53 |
54 | 55 |
56 |
57 |
58 | 59 | 60 | -------------------------------------------------------------------------------- /web/pages/back/books/books_insert.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | <% 6 | String path = request.getContextPath(); 7 | String basePath = request.getScheme() + "://" 8 | + request.getServerName() + ":" + request.getServerPort() 9 | + path + "/"; 10 | %> 11 | 12 | 13 | 14 | YF图书管理系统 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 | <%--aid--%> 48 |
49 | 50 |
51 | 56 |
57 |
58 |
59 | 60 | 61 | <%--iid--%> 62 |
63 | 64 |
65 | 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 | -------------------------------------------------------------------------------- /web/pages/back/books/books_list.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | <% 6 | String path = request.getContextPath(); 7 | String basePath = request.getScheme() + "://" 8 | + request.getServerName() + ":" + request.getServerPort() 9 | + path + "/"; 10 | %> 11 | 12 | 13 | 14 | YF图书管理系统 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | ${allbooks} 25 | 26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 53 | 54 | 55 |
编号分类名称管理员图书名称创建日期状态
${books.bid}${books.item.name}${books.admin.aid}${books.name}${books.credate} 46 | 47 | 上架 48 | 49 | 50 | 下架 51 | 52 |
56 |
57 | 58 |
59 |
60 |
61 |
62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /web/pages/back/footer.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: gsy 4 | Date: 2018/2/20 5 | Time: 21:49 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 13 | -------------------------------------------------------------------------------- /web/pages/back/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 18 | 19 | 91 | -------------------------------------------------------------------------------- /web/pages/back/lenbook/lenbook_insert.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | <% 6 | String path = request.getContextPath(); 7 | String basePath = request.getScheme() + "://" 8 | + request.getServerName() + ":" + request.getServerPort() 9 | + path + "/"; 10 | %> 11 | 12 | 13 | 14 | YF图书管理系统 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 | <%--aid--%> 48 |
49 | 50 |
51 | 56 |
57 |
58 |
59 | 60 | 61 | <%--iid--%> 62 |
63 | 64 |
65 | 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 | -------------------------------------------------------------------------------- /web/pages/back/member/item_insert.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | <% 6 | String path = request.getContextPath(); 7 | String basePath = request.getScheme() + "://" 8 | + request.getServerName() + ":" + request.getServerPort() 9 | + path + "/"; 10 | %> 11 | 12 | 13 | 14 | YF图书管理系统 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 | -------------------------------------------------------------------------------- /web/pages/back/member/item_list.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | <% 6 | String path = request.getContextPath(); 7 | String basePath = request.getScheme() + "://" 8 | + request.getServerName() + ":" + request.getServerPort() 9 | + path + "/"; 10 | %> 11 | 12 | 13 | 14 | YF图书管理系统 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 |
编号分类名称简介
${item.iid}${item.name}${item.note}
43 |
44 |
45 |
46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /web/pages/back/member/member_insert.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%-- 3 | Created by IntelliJ IDEA. 4 | User: gsy 5 | Date: 2018/2/6 6 | Time: 22:32 7 | To change this template use File | Settings | File Templates. 8 | --%> 9 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 10 | <% 11 | String path = request.getContextPath(); 12 | String basePath = request.getScheme() + "://" 13 | + request.getServerName() + ":" + request.getServerPort() 14 | + path +"/"; 15 | %> 16 | 17 | 18 | 19 | 20 | 21 | YF图书管理系统 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 | 115 | -------------------------------------------------------------------------------- /web/pages/forward.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page pageEncoding="UTF-8" %> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme() + "://" 6 | + request.getServerName() + ":" + request.getServerPort() 7 | + path ; 8 | %> 9 | 10 | 11 | 12 | 跳转页面 13 | 14 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /web/pages/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://www.ylcto.cn/c" %> 2 | <%-- 3 | Created by IntelliJ IDEA. 4 | User: gsy 5 | Date: 2018/2/6 6 | Time: 22:32 7 | To change this template use File | Settings | File Templates. 8 | --%> 9 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 10 | <% 11 | String path = request.getContextPath(); 12 | String basePath = request.getScheme() + "://" 13 | + request.getServerName() + ":" + request.getServerPort() 14 | + path ; 15 | %> 16 | 17 | 18 | 19 | 20 | 21 | YF图书管理系统 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 | -------------------------------------------------------------------------------- /web/pages/split_bar.jsp: -------------------------------------------------------------------------------- 1 | <%@ page pageEncoding="UTF-8"%> 2 | 3 | <%-- 4 |
5 | 6 |
7 | --%> 8 | <% 9 | request.setCharacterEncoding("UTF-8") ; 10 | String path = request.getContextPath(); 11 | String basePath = request.getScheme() + "://" 12 | + request.getServerName() + ":" + request.getServerPort() 13 | + path; 14 | %> 15 | <% 16 | String url = null ; 17 | int currentPage = 1 ; 18 | int lineSize = 5 ; 19 | String column = null ; 20 | String keyWord = null ; 21 | int allRecorders = 0 ; 22 | int pageSize = 0 ; 23 | int lsData [] = new int [] {1,5,10,15,20,30,50,100} ; 24 | int seed = 3 ; // 种子数 25 | String paramName = request.getParameter("paramName") ; 26 | String paramValue = request.getParameter("paramValue") ; 27 | %> 28 | 29 | <% // 接收传递的参数 30 | try { 31 | currentPage = (Integer) request.getAttribute("currentPage") ; 32 | } catch (Exception e) {} 33 | try { 34 | allRecorders = (Integer)request.getAttribute("allRecorders") ; 35 | } catch (Exception e) {} 36 | try { 37 | lineSize = (Integer) request.getAttribute("lineSize") ; 38 | } catch (Exception e) {} 39 | column = (String) request.getAttribute("column") ; 40 | keyWord = (String) request.getAttribute("keyWord") ; 41 | url = basePath + request.getAttribute("url") ; 42 | %> 43 | <% 44 | if (allRecorders > 0) { 45 | pageSize = (allRecorders + lineSize - 1) / lineSize ; 46 | } else { // 没有记录 47 | pageSize = 1 ; 48 | } 49 | %> 50 | 51 | 62 |
    63 | <% 64 | if (pageSize > seed * 3) { 65 | %> 66 |
  • ">1
  • 67 | 68 | <% 69 | if (currentPage > seed * 2) { 70 | %> 71 |
  • ...
  • 72 | <% 73 | int startPage = currentPage - seed ; 74 | int endPage = currentPage + seed ; 75 | for (int x = startPage ; x <= endPage ; x ++) { 76 | if(x < pageSize) { 77 | %> 78 |
  • "><%=x%>
  • 79 | <% 80 | } 81 | } 82 | if ((currentPage + seed * 2) <= pageSize) { 83 | %> 84 |
  • ...
  • 85 | <% 86 | } 87 | } else { // 还在6页以前 88 | for (int x = 2 ; x <= currentPage + seed ; x ++) { 89 | %> 90 |
  • "><%=x%>
  • 91 | <% 92 | } 93 | if ((currentPage + seed * 2) <= pageSize) { 94 | %> 95 |
  • ...
  • 96 | <% 97 | } 98 | } 99 | %> 100 |
  • "><%=pageSize%>
  • 101 | <% 102 | } else { 103 | for (int x = 1 ; x <= pageSize ; x ++) { 104 | %> 105 |
  • "><%=x%>
  • 106 | <% 107 | } 108 | } 109 | %> 110 |
-------------------------------------------------------------------------------- /web/validate/js/Message_zh_CN.js: -------------------------------------------------------------------------------- 1 | $.extend($.validator.messages, { 2 | required: "该字段不允许为空!", 3 | remote: "数据输入错误,请重新输入!", 4 | email: "请输入正确的EMAIL地址!", 5 | url: "请输入合法的网址!", 6 | date: "请输入合法的日期!", 7 | dateISO: "请输入合法的日期(例如:yyyy-mm-dd或yyyy/mm/dd)!", 8 | number: "请输入合法的数字(整数或小数)!", 9 | digits: "请输入整型数据!", 10 | creditcard: "请输入合法的信用卡号!", 11 | equalTo: "两次输入的数据内容不相同!", 12 | accept: "文件后缀不符合要求!", 13 | extension : "该文件不允许使用!" , 14 | maxlength: $.validator.format("输入内容长度不能大于{0}"), 15 | minlength: $.validator.format("输入内容长度不能少于{0}!"), 16 | rangelength: $.validator.format("输入数据的长度应该为{0} ~ {1}!"), 17 | range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), 18 | max: $.validator.format("可以输入的最大值为 {0} !"), 19 | min: $.validator.format("可以输入的最小值为 {0} !") 20 | }); -------------------------------------------------------------------------------- /web/validate/js/additional-methods.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Validation Plugin - v1.13.1 - 10/14/2014 2 | * http://jqueryvalidation.org/ 3 | * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ 4 | !function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):a(jQuery)}(function(a){!function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g="string"==typeof d?d.replace(/\s/g,"").replace(/,/g,"|"):"image/*",h=this.optional(c);if(h)return h;if("file"===a(c).attr("type")&&(g=g.replace(/\*/g,".*"),c.files&&c.files.length))for(e=0;ec;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number"),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number"),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a)},"Please specify a valid BIC code"),a.validator.addMethod("cifES",function(a){"use strict";var b,c,d,e,f,g,h=[];if(a=a.toUpperCase(),!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)"))return!1;for(d=0;9>d;d++)h[d]=parseInt(a.charAt(d),10);for(c=h[2]+h[4]+h[6],e=1;8>e;e+=2)f=(2*h[e]).toString(),g=f.charAt(1),c+=parseInt(f.charAt(0),10)+(""===g?0:parseInt(g,10));return/^[ABCDEFGHJNPQRSUVW]{1}/.test(a)?(c+="",b=10-parseInt(c.charAt(c.length-1),10),a+=b,h[8].toString()===String.fromCharCode(64+b)||h[8].toString()===a.charAt(a.length-1)):!1},"Please specify a valid CIF number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:128&d?!0:!1},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=e?!0:c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},"Please enter a correct date"),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(f,e-1,d,12,0,0,0),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d?!0:!1):h=!1,this.optional(b)||h},"Please enter a correct date"),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},"Please enter a correct date"),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp(".("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="";if(!/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(l))return!1;if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("nieES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[T]{1}/.test(a)?a[8]===/^[T]{1}[A-Z0-9]{8}$/.test(a):/^[XYZ]{1}/.test(a)?a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.replace("X","0").replace("Y","1").replace("Z","2").substring(0,8)%23):!1:!1},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):/^[KLM]{1}/.test(a)?a[8]===String.fromCharCode(64):!1:!1},"Please specify a valid NIF number."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return this.optional(b)?!0:("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),jQuery.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=e||"undefined"==typeof c.caseSensitive?!1:c.caseSensitive,g=e||"undefined"==typeof c.includeTerritories?!1:c.includeTerritories,h=e||"undefined"==typeof c.includeMilitary?!1:c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;17>b;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;cThis is a p

35 | * @before $.metadata.setType("class") 36 | * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" 37 | * @desc Reads metadata from the class attribute 38 | * 39 | * @example

This is a p

40 | * @before $.metadata.setType("attr", "data") 41 | * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" 42 | * @desc Reads metadata from a "data" attribute 43 | * 44 | * @example

This is a p

45 | * @before $.metadata.setType("elem", "script") 46 | * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" 47 | * @desc Reads metadata from a nested script element 48 | * 49 | * @param String type The encoding type 50 | * @param String name The name of the attribute to be used to get metadata (optional) 51 | * @cat Plugins/Metadata 52 | * @descr Sets the type of encoding to be used when loading metadata for the first time 53 | * @type undefined 54 | * @see metadata() 55 | */ 56 | 57 | (function($) { 58 | 59 | $.extend({ 60 | metadata : { 61 | defaults : { 62 | type: 'class', 63 | name: 'metadata', 64 | cre: /({.*})/, 65 | single: 'metadata' 66 | }, 67 | setType: function( type, name ){ 68 | this.defaults.type = type; 69 | this.defaults.name = name; 70 | }, 71 | get: function( elem, opts ){ 72 | var settings = $.extend({},this.defaults,opts); 73 | // check for empty string in single property 74 | if ( !settings.single.length ) settings.single = 'metadata'; 75 | 76 | var data = $.data(elem, settings.single); 77 | // returned cached data if it already exists 78 | if ( data ) return data; 79 | 80 | data = "{}"; 81 | 82 | if ( settings.type == "class" ) { 83 | var m = settings.cre.exec( elem.className ); 84 | if ( m ) 85 | data = m[1]; 86 | } else if ( settings.type == "elem" ) { 87 | if( !elem.getElementsByTagName ) 88 | return undefined; 89 | var e = elem.getElementsByTagName(settings.name); 90 | if ( e.length ) 91 | data = $.trim(e[0].innerHTML); 92 | } else if ( elem.getAttribute != undefined ) { 93 | var attr = elem.getAttribute( settings.name ); 94 | if ( attr ) 95 | data = attr; 96 | } 97 | 98 | if ( data.indexOf( '{' ) <0 ) 99 | data = "{" + data + "}"; 100 | 101 | data = eval("(" + data + ")"); 102 | 103 | $.data( elem, settings.single, data ); 104 | return data; 105 | } 106 | } 107 | }); 108 | 109 | /** 110 | * Returns the metadata object for the first member of the jQuery object. 111 | * 112 | * @name metadata 113 | * @descr Returns element's metadata object 114 | * @param Object opts An object contianing settings to override the defaults 115 | * @type jQuery 116 | * @cat Plugins/Metadata 117 | */ 118 | $.fn.metadata = function( opts ){ 119 | return $.metadata.get( this[0], opts ); 120 | }; 121 | 122 | })(jQuery); -------------------------------------------------------------------------------- /web/validate/js/jquery.validate.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Validation Plugin - v1.13.1 - 10/14/2014 2 | * http://jqueryvalidation.org/ 3 | * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ 4 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+"")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})}); -------------------------------------------------------------------------------- /web/validate/login.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | $("#loginForm").validate({ 3 | debug:true, 4 | submitHandler:function(form){ 5 | form.submit(); // 表示采用手工提交 6 | }, 7 | rules:{ 8 | aid:{ 9 | required:true 10 | }, 11 | password:{ 12 | required:true, 13 | rangelength:[0,12] 14 | } 15 | } 16 | }) 17 | }); 18 | -------------------------------------------------------------------------------- /web/validate/member_insert.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | $("#insertForm").validate({ 3 | debug:true, 4 | submitHandler:function(form){ 5 | form.submit(); // 表示采用手工提交 6 | }, 7 | rules:{ 8 | mid:{ 9 | required:true 10 | }, 11 | name:{ 12 | required:true 13 | 14 | }, 15 | age:{ 16 | required:true, 17 | digits:true 18 | }, 19 | phone:{ 20 | required:true 21 | }, 22 | note:{ 23 | required:true; 24 | } 25 | 26 | } 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /数据库脚本.sql: -------------------------------------------------------------------------------- 1 | -- 删除数据库 2 | DROP DATABASE booksystem; 3 | -- 创建数据库 4 | CREATE DATABASE booksystem; 5 | -- 使用数据库 6 | USE booksystem; 7 | -- 删除数据表 8 | 9 | -- 创建数据表 10 | -- 1、创建管理员表 11 | CREATE TABLE admin ( 12 | aid VARCHAR(50) NOT NULL , 13 | password VARCHAR(32), 14 | lastdate DATETIME,--最后一次登录日 15 | flag INT, 16 | status INT, 17 | CONSTRAINT pk_aid PRIMARY KEY (aid) 18 | ); 19 | -- 2、用户表 20 | CREATE TABLE member ( 21 | mid VARCHAR(50) not null, 22 | name VARCHAR(50), 23 | age INT, 24 | sex INT, 25 | phone VARCHAR(32), 26 | CONSTRAINT pk_mid PRIMARY KEY (mid) 27 | ); 28 | -- 3、类别表 29 | CREATE TABLE item( 30 | iid INT not null AUTO_INCREMENT, 31 | name VARCHAR(100), 32 | note TEXT, 33 | CONSTRAINT pk_iid PRIMARY KEY (iid) 34 | ); 35 | 36 | -- 4、课程详情表 37 | 38 | CREATE TABLE books ( 39 | bid INT not null AUTO_INCREMENT, 40 | iid INT, 41 | aid VARCHAR(50), 42 | name VARCHAR(100), 43 | credate DATETIME, 44 | status INT, 45 | note TEXT, 46 | CONSTRAINT pk_bid PRIMARY KEY (bid), 47 | CONSTRAINT fk_iid FOREIGN KEY (iid) REFERENCES item(iid) ON DELETE CASCADE, 48 | CONSTRAINT fk_aid FOREIGN KEY (aid) REFERENCES admin(aid) ON DELETE CASCADE 49 | ); 50 | -- 5、借书详情表 51 | CREATE TABLE lenbook ( 52 | leid INT not null AUTO_INCREMENT, 53 | bid INT, 54 | mid VARCHAR(50), 55 | credate DATETIME, 56 | retdate DATETIME, 57 | CONSTRAINT pk_leid PRIMARY KEY (leid), 58 | CONSTRAINT fk_bid FOREIGN KEY (bid) REFERENCES books(bid) ON DELETE CASCADE, 59 | CONSTRAINT fk_mid FOREIGN KEY (mid) REFERENCES member(mid) ON DELETE CASCADE 60 | ); 61 | 62 | -- 增加测试数据 63 | -- 管理员ID:admin ,管理员密码:ylcto 64 | INSERT INTO admin(aid,password,flag,status)VALUES ('admin','09BDE7C801111CB40BFD47EBAA6C4343',1,1); 65 | -- 提交 66 | COMMIT; -------------------------------------------------------------------------------- /需要的jar包.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongShengyue/OnlineBooks/dfc5eacc08d3b0396c266049548618f6fb9587ea/需要的jar包.zip --------------------------------------------------------------------------------