一、简介
图书馆管理系统代表了图书馆管理的信息化,不仅是体现图书馆现代化形象的一个重要标志,而且对于提高全体师生查找书籍效率,提高图书的利用率、降低各项成本有十分积极的作用。
二、运行环境
IntelliJ IDEA 、 mysql 、tomcat
三、语言
JavaWeb 、 servlet、jsp、html、css、javaScript
四、jar包说明
4.1 c3p0辅助包
- mchange-commons-java-0.2.19
- c3p0-0.9.5.5
4.2 jstl
- jstl-1.2
- standard-1.1.2
4.3.数据库连接
- mysql-connector-java-8.0.17
4.4.文件上传辅助包
- commons-fileupload-1.4
- commons-io-2.8.0
五、运行项目
- 创建bookdb数据库
- 运行sql文件
- 修改c3p0里的user和password
- 配置tomcat 和 各种lib包
六、项目截图
6.1登录界面
6.2 数据可视化界面
6.3图书管理界面
6.4添加书籍界面
6.5图书借阅界面
七、jsp源代码
7.1添加书籍
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
<script src="Js/jquery-3.3.1.min.js"></script>
<script>
//图片预览
function getFullPath(obj){
if (obj){
//ie
if (window.navigator.userAgent.indexOf("MSIE") >= 1){
obj.select();
return document.selection.createRange().text;
}else if (window.navigator.userAgent.indexOf("Firefox") >= 1){
//firefox
return window.URL.createObjectURL(obj.files.item(0));
}else if(navigator.userAgent.indexOf("Chrome")>0){
//chrome
return window.URL.createObjectURL(obj.files.item(0));
}
return obj.value;
}
}
$(function(){
$("#pic").change(function(){
var path = getFullPath($(this)[0]);
console.log(path);
$("#imgPic").prop("src",path);
});
});
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">书籍管理 > 添加书籍</h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加产品开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="book.let?type=add" method="post" enctype="multipart/form-data">
<table width="100%"class="cont">
<tr>
<td width="2%"> </td>
<td width="15%">名称:</td>
<td width="25%"><input class="text" type="text" name="name" value="" /></td>
<td rowspan="9" valign="top" >
<fieldset style="margin-left:50px;width: 210px; height: 360px;">
<legend>图片预览</legend>
<img id="imgPic" alt="图片预览" src="Images/svg/zengjia.svg" width="200px" height="350px"/>
</fieldset>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>类型:</td>
<td width="20%">
<select id="book_type" name="typeId">
<option value="0">---请选择---</option>
<c:forEach items="${types}" var="t">
<option value="${t.id}">${t.name}</option>
</c:forEach>
</select>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>图片:</td>
<td width="20%"><input type="file" id="pic" name="pic" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>库存量:</td>
<td width="20%"><input class="text" style="width:50px;" type="number" name="stock" value="100" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>单价:</td>
<td width="20%"><input class="text" style="width:100px;" type="text" name="price" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>出版社:</td>
<td width="20%"><input class="text" type="text" name="publish"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>作者:</td>
<td width="20%"><input class="text" type="text" name="author"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>存放地址:</td>
<td width="20%"><input class="text" type="text" name="address"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td> </td>
<td>简介:</td>
<td colspan="2"><textarea cols="150" rows="20" name="desc"></textarea></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td colspan="3"><input class="btn" type="submit" value="提交" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加产品结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.2书籍详情
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">书籍管理 > 书籍详情</h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加产品开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="" method="">
<table width="100%"class="cont">
<tr>
<td width="2%"> </td>
<td>编号:</td>
<td width="20%"><input class="text" type="text" name="bookId" value="${book.id}" disabled="disabled"/></td>
<td rowspan="9" valign="top" >
<fieldset style="margin-left:50px;width: 220px; height: 360px;">
<legend>封面</legend>
<img src="${book.pic}" width="200px"; height="350px"/>
</fieldset>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="15%">名称:</td>
<td width="25%"><input class="text" type="text" name="name" value="${book.name}" disabled="disabled"/></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>类型:</td>
<td width="20%">
<input class="text" type="text" name="type" value="${book.type.name}" disabled="disabled"/>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>库存量:</td>
<td width="20%"><input class="text" style="width:50px;" type="number" name="stock" value="${book.stock}" disabled="disabled" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>单价:</td>
<td width="20%"><input class="text" style="width:100px;" type="text" name="price" value="${book.price}" disabled="disabled" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>出版社:</td>
<td width="20%"><input class="text" type="text" name="publish" value="${book.publish}" disabled="disabled"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>作者:</td>
<td width="20%"><input class="text" type="text" name="author" value="${book.author}" disabled="disabled"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>存放地址:</td>
<td width="20%"><input class="text" type="text" name="address" value="${book.address}" disabled="disabled"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td> </td>
<td>简介:</td>
<td colspan="2"><textarea cols="150" rows="20" disabled="disabled">${book.desc}</textarea></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td colspan="3"><input class="btn" type="button" value="返回" onclick="window.location='book.let?type=query&pageIndex=1';" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加产品结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.3 书籍列表
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">书籍管理 > 书籍列表 </h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 产品列表开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<table width="100%" class="cont tr_color">
<tr>
<th>编号</th>
<th>名称</th>
<th>类型</th>
<th>作者</th>
<th>出版社</th>
<th>库存</th>
<th>封面</th>
<th>操作</th>
</tr>
<c:forEach items="${books}" var="b">
<tr align="center" class="d">
<td><a href="book.let?type=details&id=${b.id}">${b.id}</a></td>
<td>${b.name}</td>
<td>${b.type.name}</td>
<td>${b.author}</td>
<td>${b.publish}</td>
<td>${b.stock}</td>
<td><img src="${b.pic}" class="cover"/></td>
<td>
<a onclick="return confirm('确认修改');" href="book.let?type=modifypre&id=${b.id}">修改</a>
<a onclick="return confirm('确认删除');" href="book.let?type=remove&id=${b.id}">删除</a>
</td>
</tr>
</c:forEach>
<tr><td colspan="8" align="center">
<div class="pager">
<ul class="clearfix">
<li><a href="book.let?type=query&pageIndex=${param.pageIndex-1}">上一页</a></li>
<c:forEach var="i" begin="1" end="${pageCount}" step="1">
<c:if test="${i==param.pageIndex}">
<li class="current"><a href="book.let?type=query&pageIndex=${i}">${i}</a></li>
</c:if>
<c:if test="${i!=param.pageIndex}">
<li><a href="book.let?type=query&pageIndex=${i}">${i}</a></li>
</c:if>
</c:forEach>
<li><a href="book.let?type=query&pageIndex=${param.pageIndex+1}">下一页</a></li>
</ul>
</div>
</td></tr>
</table>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 产品列表结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.4 修改书籍信息
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
<script src="Js/jquery-3.3.1.min.js"></script>
<script>
//图片预览
function getFullPath(obj){
if (obj){
//ie
if (window.navigator.userAgent.indexOf("MSIE") >= 1){
obj.select();
return document.selection.createRange().text;
}else if (window.navigator.userAgent.indexOf("Firefox") >= 1){
//firefox
return window.URL.createObjectURL(obj.files.item(0));
}else if(navigator.userAgent.indexOf("Chrome")>0){
//chrome
return window.URL.createObjectURL(obj.files.item(0));
}
return obj.value;
}
}
$(function(){
$("#filePic").change(function(){
var path = getFullPath($(this)[0]);
console.log(path);
$("#imgPic").prop("src",path);
});
});
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">书籍管理 > 修改书籍</h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加产品开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="book.let?type=modify" method="post" enctype="multipart/form-data">
<table width="100%" class="cont">
<tr>
<td width="2%"> </td>
<td>编号:</td>
<td width="20%"><input class="text" type="text" name="id" value="${book.id}" readonly/></td>
<td rowspan="8" valign="top" >
<fieldset style="width: 210px; height: 370px;">
<legend>图片预览</legend>
<img id="imgPic" src="${book.pic}" width="200px" height="350px"/>
</fieldset>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="15%">名称:</td>
<td width="25%"><input class="text" type="text" name="name" value="${book.name}" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>类型:</td>
<td width="20%">
<select id="book_type" name="typeId">
<option value="0">---请选择---</option>
<c:forEach items="${types}" var="t">
<c:if test="${book.typeId== t.id}">
<option value="${t.id}" selected>${t.name}</option>
</c:if>
<c:if test="${book.typeId!=t.id}">
<option value="${t.id}" >${t.name}</option>
</c:if>
</c:forEach>
</select>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>图片:</td>
<!--
1.用户不需要修改封面(不会选择图片) filePic.value==>后台 文件名:"" 数据库中应该保存之前的图片路径
2.用户需要修改封面,文件上传(保存文件)
-->
<td width="20%">
<!--保存之前的图片路径 book.pic -->
<input type="hidden" name="pic" value="${book.pic}">
<input type="file" id="filePic" name="filePic" value="${book.pic}"/>
</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>库存量:</td>
<td width="20%"><input class="text" style="width:50px;" type="number" name="stock" value="${book.stock}" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>单价:</td>
<td width="20%"><input class="text" style="width:100px;" type="text" name="price" value="${book.price}" /></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>出版社:</td>
<td width="20%"><input class="text" type="text" name="publish" value="${book.publish}"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>作者:</td>
<td width="20%"><input class="text" type="text" name="author" value="${book.author}"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td>存放地址:</td>
<td width="20%"><input class="text" type="text" name="address" value="${book.address}"/></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td> </td>
<td>简介:</td>
<td colspan="2"><textarea cols="150" rows="20" name="desc">${book.desc}</textarea></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td colspan="3"><input class="btn" type="submit" value="提交" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加产品结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.5书籍借阅
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
<script src="Js/jquery-3.3.1.min.js"></script>
<script>
/**
* 获取系统的当前时间
* 2021-02-12
**/
function getCurrentDate(){
var dateObj = new Date();
var year = dateObj.getFullYear();
var month = dateObj.getMonth()+1;//0~ 11
var date = dateObj.getDate();
var dateStr = year+"-"+(month>=10?month:"0"+month)+"-"+(date>=10?date:"0"+date);
return dateStr;
}
/**
* 获取归还时间
* count:借阅时间
* 2012-12-1 : 20
* 2012-12-21:归还
* 毫秒: 1s = 1000ms 1m = 60s 1h= 60m 1d = 24h
*
* */
function getBackDate(count){
//1.获取系统的当前时间
var dateObj = new Date();
//2.转成毫秒数
var mills = dateObj.getMilliseconds();
//3
mills += count*24*60*60*1000;
//4.转成日期出来
dateObj.setMilliseconds(mills);
//5.时间转成字符串
var year = dateObj.getFullYear();
var month = dateObj.getMonth()+1;//0~ 11
var date = dateObj.getDate();
var dateStr = year+"-"+(month>=10?month:"0"+month)+"-"+(date>=10?date:"0"+date);
return dateStr;
}
//会员编号 确定点击事件
// 规定返回要设置的属性值的函数。
//index - 检索集合中元素的 index 位置。
//currentvalue - 检索被选元素的当前属性值。
$(function(){
$("#btnQueryBook").prop("disabled","disabled");
$("#btnSubmit").prop("disabled","disabled");
var member = null;
$("#btnQuery").click(function(){
//1.获取用户输入的身份证号
var content = $("#memberId").val();
//判断为null ,""
if(!content){
alert("请输入用户号");
return;
}
//2.调用js-ajax()/post()/get 通过ajax给input框设置返回值
var url="member.let?type=doajax&idn="+content;
$.get(url,function(data,status){
//json字符串
//{"balance":145.0,"id":1,"idNumber":"300312199506150011","name":"andy","pwd":"andyliu","regdate":1627747200000,"tel":"13374645654","type":{"amount":"5","discount":100.0,"id":1,"keepDay":30,"name":"普通会员","recharge":100},"typeId":1}
console.log(data);
//1.json字符串--》json对象
//如果key是一个对象 则会将其输出为String类型的字符串
member = JSON.parse(data);
console.log(member.balance+","+member.type.name+","+member.type.amount+","+member.name);
//2.给组件赋值
$("#name").val(member.name);
$("#type").val(member.type.name);
$("#amount").val(member.type.amount);
$("#balance").val(member.balance);
});
//查询用户的功能关闭
$(this).prop("disabled","disabled");
//开启了查询按钮的功能
$("#btnQueryBook").removeAttr("disabled");
});
//保存所有添加过的书名
var bookNameList = new Array();
$("#btnQueryBook").click(function(){
var name=$("#bookContent").val();
var url = "book.let?type=doajax&name="+name;
$.get(url,function(data,status){
//{}/一本书的json
console.log(data);
//特殊情况 {}
if(data==="{}"){
alert("当前书籍不存在,查找失败");
$("#bookContent").val("");
return;
}
//判断这本书名是否存在过
if(bookNameList.indexOf(name)>=0){
alert("当前书籍已添加,添加失败");
return;
}
//添加书名到数组
bookNameList.push(name);
var book = JSON.parse(data);
/**
*<tr align="center" class="d">
<td><input type="checkbox" value="1" checked class="ck" /></td>
<td>罗小黑战记</td>
<td>2010-10-01</td>
<td>2010-10-31</td>
<td>北京联合出版社</td>
<td>东区-01-02</td>
<td>39.9</td>
</tr>
*/
//1.创建行
var tr = $("<tr align=\"center\" class=\"d\">");
//2.创建多个列
var tdCheck = $("<td><input type=\"checkbox\" value=\""+book.id+"\" class=\"ck\" checked /></td>");
var tdName = $("<td>"+book.name+"</td>");
//借阅日期:系统当前时间
//归还日期:系统当前时间 +会员等级中.keeyDay
var tdRentDate = $("<td>"+getCurrentDate()+"</td>");
var tdBackDate = $("<td>"+getBackDate(member.type.keepDay)+"</td>");
var tdPublish = $("<td>"+book.publish+"</td>");
var tdAddress = $("<td>"+book.address+"</td>");
var tdPrice = $("<td>"+book.price+"</td>");
//3.行加列
tr.append(tdCheck);
tr.append(tdName);
tr.append(tdRentDate);
tr.append(tdBackDate);
tr.append(tdPublish);
tr.append(tdAddress);
tr.append(tdPrice);
//4.表加行
$("#tdBook").append(tr);
$("#bookContent").val("");
$("#btnSubmit").removeAttr("disabled");
});
});
//全选功能
$("#ckAll").click(function(){
$(".ck").prop("checked",$(this).prop("checked"));
});
//完成借阅功能
$("#btnSubmit").click(function(){
//1.获取用户选择的书籍编号(多本 1,2,3 1_2_3)
var ids = new Array();
var count = 0;
$(".ck").each(function () {
if($(this).prop("checked")){
ids.push($(this).val());
count++;
}
});
if(count===0){
alert("请选择借阅书籍");
return;
}
if(count>member.type.amount){
alert("借阅数量超出范围");
return;
}
//请求servlet http://localhost:8888/mybook_war_exploded/record.let?type=add&mid=1&ids=5_4_9_10
location.href="record.let?type=add&mid="+member.id+"&ids="+ids.join("_");
});
});
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">常用功能 > 图书借阅 </h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="20" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 会员信息开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<fieldset>
<legend>查询会员</legend>
<table width="100%" border="0" class="cont" >
<tr>
<td width="8%" class="run-right"> 会员编号</td>
<td colspan="7"><input class="text" type="text" id="memberId" name="memberId"/>
<input type="button" id="btnQuery" value="确定" style="width: 80px;"/></td>
</td>
</tr>
<tr>
<td width="8%" class="run-right">会员名称</td>
<td width="17%"><input class="text" type="text" id="name" disabled/></td>
<td width="8%" class="run-right">会员类型:</td>
<td width="17%"><input class="text" type="text" id="type" disabled/></td>
<td width="8%" class="run-right">可借数量</td>
<td width="17%"><input class="text" type="text" id="amount" disabled/></td>
<td width="8%" class="run-right">账户余额</td>
<td width="17%"><input class="text" type="text" id="balance" disabled/></td>
</tr>
</table>
</fieldset>
</td>
<td width="2%"> </td>
</tr>
<!--空行-->
<tr>
<td height="40" colspan="3">
</td>
</tr>
<!--图书搜索条-->
<tr>
<td width="2%"> </td>
<td width="96%">
<fieldset>
<legend>查询图书</legend>
<table width="100%" border="1" class="cont" >
<tr>
<td colspan="8">
请输入: <input class="text" type="text" id="bookContent" name="bookContent" placeholder="输入条形码\书名"/>
<input type="button" id="btnQueryBook" value="确定" style="width: 80px;"/>
<input type="button" id="btnSubmit" value="完成借阅" style="width: 80px;"/>
</td>
</tr>
</table>
</fieldset>
</td>
<td width="2%"> </td>
</tr>
<tr><td height="20" colspan="3"></td></tr>
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="" method="">
<table width="100%" class="cont tr_color" id="tdBook">
<tr>
<th><input type="checkbox" id="ckAll" checked/>全选/全不选</th>
<th>书籍名</th>
<th>借阅时间</th>
<th>应还时间</th>
<th>出版社</th>
<th>书架</th>
<th>定价(元)</th>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 产品列表结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.6借阅书籍
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
<script src="Js/jquery-3.3.1.min.js"></script>
<script>
$(function(){
$("#btnQuery").click(function(){
//0.清理
$("#tbRecord").find("tbody").html("");
//1.获取id
var typeId = $(":radio:checked").prop("value");
//2.获取关键字
var keyword = $("#keyword").val();
//3.组成url
var url = "record.let?type=doajax&typeId="+typeId+"&keyword="+keyword;
//4.发送并获取数据
$.get(url,function(data){
console.log(data);
//5.数据加载到页面
if(data==="[]" ){
alert("没有信息展示");
return;
}
//1. data=>json对象
var records = JSON.parse(data);
for(var i=0;i<records.length;i++){
var record = records[i];
//tr
var tr = $(" <tr align=\"center\" class=\"d\">");
var tdMName = $(" <td>"+record.memberName+"</td>");
var tdBName = $("<td>"+record.bookName+"</td>");
var tdRentDate = $("<td>"+record.rentDate+"</td>");
var tdBackDate = $("<td>"+ (record.backDate===undefined?"":record.backDate)+"</td>");
var tdDeposit = $("<td>"+record.deposit+"</td>");
//5-td
tr.append(tdMName);
tr.append(tdBName);
tr.append(tdRentDate);
tr.append(tdBackDate);
tr.append(tdDeposit);
//加入到表
$("#tbRecord").find("tbody").append(tr);
}
});
});
});
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">常用功能 > 借阅历史记录 </h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td width="96%">
<fieldset>
<legend>查询条件</legend>
<table width="100%" class="cont" >
<tr>
<td colspan="8" align="center">
<input type="radio" name="query" value="0" checked/>全部
<input type="radio" name="query" value="1"/>已归还
<input type="radio" name="query" value="2"/>未归还
<input type="radio" name="query" value="3"/>最近一周需归还
请输入关键字: <input class="text" type="text" id="keyword" name="keyword"/>
<input type="button" id="btnQuery" value="搜索" style="width: 80px;"/></td>
</td>
</tr>
</table>
</fieldset>
</td>
<td width="2%"> </td>
</tr>
<!--空行-->
<tr>
<td height="40" colspan="3">
</td>
</tr>
<!-- 产品列表开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="" method="">
<table width="100%" class="cont tr_color" id="tbRecord">
<thead>
<tr>
<th>会员名称</th>
<th>书籍名称</th>
<th>借阅时间</th>
<th>归还时间</th>
<th>押金(元)</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 产品列表结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.7修改密码
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">个人管理 > 修改密码</h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加产品开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="user.let?type=modifyPwd" method="post">
<table width="100%"class="cont">
<tr>
<td width="2%"> </td>
<td width="80px">原密码:</td>
<td width="150px"><input class="text" type="password" name="pwd" value=""/></td>
<td class="err">原密码不匹配</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="80px"> 新密码:</td>
<td width="150px"><input class="text" type="password" name="newpwd" value="" /></td>
<td></td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="80px">确认密码:</td>
<td width="150px"><input class="text" type="password" name="newpwd2" value="" /></td>
<td class="err">两次密码不相同</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="80px"></td>
<td width="150px"><input class="btn" type="submit" value="提交" /></td>
<td ></td>
<td width="2%"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加产品结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td width="51%" class="left_txt">
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.8类型修改
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">图书类型管理 > 修改类型 </h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加栏目开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="type.let?type=modify" method="post">
<table width="40%" class="cont">
<tr>
<td width="2%"> </td>
<td width="25%">类型编号:</td>
<td width="40%"><input type="text" id="typeId" class="text" name="txtTypeId" value="${type.id}" disabled />
<input type="hidden" class="text" name="typeId" value="${type.id}" />
</td>
<td class="err">*类型已存在</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="25%">类型名称:</td>
<td width="40%"><input type="text" id="typeName" class="text" name="typeName" value="${type.name}" /></td>
<td class="err">*类型已存在</td>
<td width="2%"> </td>
</tr>
<tr>
<td> </td>
<td>父类型:</td>
<td>
<select id="parentType" name="parentType" >
<c:if test="${type.parentId==0}">
<option value="0" selected>无</option>
</c:if>
<c:if test="${type.parentId!=0}">
<option value="0">无</option>
<c:forEach items = "${types}" var="t">
<c:if test="${t.id==type.parentId}">
<option value="${t.id}" selected>${t.name}</option>
</c:if>
<c:if test="${t.id!=type.parentId}">
<option value="${t.id}">${t.name}</option>
</c:if>
</c:forEach>
</c:if>
</select>
</td>
<td></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="3"><input class="btn" type="submit" value="提交" /></td>
<td> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加栏目结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td width="51%" class="left_txt">
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.9类型列表
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;"> 图书类型管理 > 管理类型</h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加栏目开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<table width="60%" class="cont tr_color">
<tr>
<th>类型编号</th>
<th>类型名称</th>
<th>父类型</th>
<th>操作</th>
</tr>
<c:forEach items="${types}" var="t">
<tr align="center" class="d">
<td>${t.id}</td>
<td>${t.name}</td>
<td>${t.parentId}</td>
<td>
<a onclick="return confirm('确认修改');" href="type.let?type=modifypre&id=${t.id}">修改</a>
<a onclick="return confirm('确认删除');" href="type.let?type=remove&id=${t.id}">删除</a>
</td>
</tr>
</c:forEach>
</table>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加栏目结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>
7.10 类型修改
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content = "图书 java jsp"/>
<meta http-equiv="author" content="phenix"/>
<link rel="stylesheet" type="text/css" href="./Style/skin.css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 头部开始 -->
<tr>
<td width="17" valign="top" background="./Images/mail_left_bg.gif">
<img src="./Images/left_top_right.gif" width="17" height="29" />
</td>
<td valign="top" background="./Images/content_bg.gif">
</td>
<td width="16" valign="top" background="./Images/mail_right_bg.gif"><img src="./Images/nav_right_bg.gif" width="16" height="29" /></td>
</tr>
<!-- 中间部分开始 -->
<tr>
<!--第一行左边框-->
<td valign="middle" background="./Images/mail_left_bg.gif"> </td>
<!--第一行中间内容-->
<td valign="top" bgcolor="#F7F8F9">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 空白行-->
<tr><td colspan="2" valign="top"> </td><td> </td><td valign="top"> </td></tr>
<tr>
<td colspan="4">
<table>
<tr>
<td width="100" align="center"><img src="./Images/mime.gif" /></td>
<td valign="bottom"><h3 style="letter-spacing:1px;">图书类型管理 > 修改类型 </h3></td>
</tr>
</table>
</td>
</tr>
<!-- 一条线 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<!-- 添加栏目开始 -->
<tr>
<td width="2%"> </td>
<td width="96%">
<table width="100%">
<tr>
<td colspan="2">
<form action="type.let?type=modify" method="post">
<table width="40%" class="cont">
<tr>
<td width="2%"> </td>
<td width="25%">类型编号:</td>
<td width="40%"><input type="text" id="typeId" class="text" name="txtTypeId" value="${type.id}" disabled />
<input type="hidden" class="text" name="typeId" value="${type.id}" />
</td>
<td class="err">*类型已存在</td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="25%">类型名称:</td>
<td width="40%"><input type="text" id="typeName" class="text" name="typeName" value="${type.name}" /></td>
<td class="err">*类型已存在</td>
<td width="2%"> </td>
</tr>
<tr>
<td> </td>
<td>父类型:</td>
<td>
<select id="parentType" name="parentType" >
<c:if test="${type.parentId==0}">
<option value="0" selected>无</option>
</c:if>
<c:if test="${type.parentId!=0}">
<option value="0">无</option>
<c:forEach items = "${types}" var="t">
<c:if test="${t.id==type.parentId}">
<option value="${t.id}" selected>${t.name}</option>
</c:if>
<c:if test="${t.id!=type.parentId}">
<option value="${t.id}">${t.name}</option>
</c:if>
</c:forEach>
</c:if>
</select>
</td>
<td></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="3"><input class="btn" type="submit" value="提交" /></td>
<td> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
<!-- 添加栏目结束 -->
<tr>
<td height="40" colspan="4">
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr><td></td></tr>
</table>
</td>
</tr>
<tr>
<td width="2%"> </td>
<td> </td><td> </td>
</tr>
</table>
</td>
<td background="./Images/mail_right_bg.gif"> </td>
</tr>
<!-- 底部部分 -->
<tr>
<td valign="bottom" background="./Images/mail_left_bg.gif">
<img src="./Images/buttom_left.gif" width="17" height="17" />
</td>
<td background="./Images/buttom_bgs.gif">
<img src="./Images/buttom_bgs.gif" width="17" height="17">
</td>
<td valign="bottom" background="./Images/mail_right_bg.gif">
<img src="./Images/buttom_right.gif" width="16" height="17" />
</td>
</tr>
</table>
</body>
</html>