1. 程式人生 > >頁面範例:圖書管理系統主頁面

頁面範例:圖書管理系統主頁面

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018\9\11 0011
  Time: 14:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>主頁面</title>
    <style type="text/css">
        #div {
            width: 800px;
            height: 600px;
            margin: 0px auto;
            border: 1px solid red;
        }

    </style>
    <script type="text/javascript" src="jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        function dopage(pageno) {//引數為當前的頁碼書
            $("input[name='pageno']").val(pageno);  //將當前頁碼或者需要的頁碼賦值給id為pageno的隱藏域

            $("#query").submit();//提交查詢表單
        }
    </script>
</head>
<body>
<div id="div">
    <h1 style="text-align: center;">圖書借閱系統</h1>
    <form action="ibookServlet.htm?choose=1" method="post" style="text-align: center;" id="query">
        <input type="hidden" value="1" name="pageno">
        圖書分類<select name="book_Type">
        <option value="0">全部</option>
        <c:forEach items="${book_typeList}" var="book_typeList">
            <option <c:if test="${book_typeList.book_type==book_type}">selected</c:if> value="${book_typeList.book_type}">${book_typeList.type_name}</option>
        </c:forEach>
    </select>&nbsp;
        圖書名稱<input type="text" name="bookName" value="${bookname}">&nbsp;
        是否借閱<select name="borrow">
        <option value="-1" >請選擇</option>
        <option value="0" <c:if test="${borrowjudge==0}">selected</c:if> >未借閱</option>
        <option value="1" <c:if test="${borrowjudge==1}">selected</c:if> >已借閱</option>
    </select>&nbsp;
        <input type="submit" value="查詢">
        <hr>
        <a href="add.jsp">新增</a>
    </form>
    <div style="margin: 0px auto; width: 580px;">
        <table>

            <tr>
                <td>圖書編號</td>
                <td>圖書分類</td>
                <td>圖書名稱</td>
                <td>作者</td>
                <td>出版社</td>
                <td>出版日期</td>
                <td>操作</td>
                <td>詳情</td>
                <td>刪除</td>
                <td>修改</td>
            </tr>
            <c:forEach items="${infoPageBean.list}" var="book">
                <tr>
                    <td>${book.book_code}</td>
                    <td>${book.book_name}</td>
                    <td>${book.type_name}</td>
                    <td>${book.book_author}</td>
                    <td>${book.publish_press}</td>
                    <td>${book.publish_date}</td>
                    <td>
                        <c:if test="${book.is_borrow==0}">未借閱</c:if>
                        <c:if test="${book.is_borrow==1}">已借閱</c:if>
                    </td>
                    <td><a href="/ibookServlet.htm?choose=5&bookCode=${book.book_code}">詳情</a></td>
                    <td><a href="/ibookServlet.htm?choose=3&bookCode=${book.book_code}">刪除</a></td>
                    <td><a href="/ibookServlet.htm?choose=4&bookCode=${book.book_code}">修改</a></td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="9">
                    <a href="javascript:dopage(1)">首頁</a>
                    <a href="javascript:dopage(${infoPageBean.pageNo-1})">上一頁</a>
                    <a href="javascript:dopage(${infoPageBean.pageNo+1})">下一頁</a>
                    <a href="javascript:dopage(${infoPageBean.totalPage})">末頁</a>
                    ${infoPageBean.pageNo}/${infoPageBean.totalPage}
                    <input type="text" id="page">&nbsp;
                    <button onclick="dopage($('#page').val())">go</button>
                </td>
            </tr>
        </table>
    </div>
</div>
</body>
</html>