圖書管理系統(tǒng)的設(shè)計(jì)與開發(fā)_第1頁(yè)
圖書管理系統(tǒng)的設(shè)計(jì)與開發(fā)_第2頁(yè)
圖書管理系統(tǒng)的設(shè)計(jì)與開發(fā)_第3頁(yè)
圖書管理系統(tǒng)的設(shè)計(jì)與開發(fā)_第4頁(yè)
圖書管理系統(tǒng)的設(shè)計(jì)與開發(fā)_第5頁(yè)
已閱讀5頁(yè),還剩51頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、 學(xué) 生 實(shí) 驗(yàn) 報(bào) 告 書實(shí)驗(yàn)課程名稱電子商務(wù)應(yīng)用技術(shù)開發(fā)開 課 學(xué) 院經(jīng)濟(jì)學(xué)院指導(dǎo)教師姓名傅魁學(xué) 生 姓 名 梁少晴 0121415710101 姜雨竹 0121415710229 阮筱鈺 0121415710230學(xué)生專業(yè)班級(jí)電商1401 電商1402 目 錄 一、系統(tǒng)概述(3)二、系統(tǒng)需求分析(3)三、系統(tǒng)總體設(shè)計(jì)(6)四、詳細(xì)設(shè)計(jì)(9)五、頁(yè)面設(shè)計(jì)及編碼實(shí)現(xiàn)(15)六、測(cè)試分析報(bào)告(50)七、結(jié)束語(yǔ)(56) 圖書館管理系統(tǒng)一、 系統(tǒng)概述1.1 系統(tǒng)開發(fā)背景和意義 圖書管理是每個(gè)高校必須切實(shí)面對(duì)的工作,但如今許多高校的圖書館管理系統(tǒng)還停留在以CS為結(jié)構(gòu)的系統(tǒng)上。隨著internet的應(yīng)

2、用日趨廣泛,以及高校內(nèi)、高校與高校間信息的交流日趨密切,以CS為結(jié)構(gòu)的信息管理系統(tǒng)以不能滿足需求,所以,高校圖書館管理系統(tǒng)必須通過更新?lián)Q代,將BS為結(jié)構(gòu)的系統(tǒng)改為以CS為結(jié)構(gòu)的系統(tǒng),這樣會(huì)大大提高系統(tǒng)的維護(hù)性以及系統(tǒng)應(yīng)用的廣泛性。由于圖書這用特殊的物品,其表現(xiàn)在數(shù)據(jù)量非常龐大,所以對(duì)數(shù)據(jù)庫(kù)的要求比較嚴(yán)格,由于oracle數(shù)據(jù)庫(kù)其檢索迅速、查找方便、可靠性高、保密性好,所以,選擇oracle數(shù)據(jù)庫(kù)為其存取數(shù)據(jù)。 隨著java技術(shù)在internet上的廣泛應(yīng)用以及java安全性高、執(zhí)行效率高的優(yōu)點(diǎn),同時(shí),java可以在任意平臺(tái)上應(yīng)用,所以可以任意組合硬件和操作系統(tǒng),既可以在windows下開發(fā),部

3、署在linux下,極大了節(jié)省了操作系統(tǒng)的費(fèi)用以及硬件的費(fèi)用。 1.2 開發(fā)環(huán)境硬件環(huán)境: 服務(wù)器端/客戶端: 處理器:Inter Pentium3以上 內(nèi)存:512M以上推薦1G或更高 硬盤空間:80G以上軟件環(huán)境: 服務(wù)器端/客戶端: 操作系統(tǒng):Windows XP/Linux 瀏覽器:Internet Explore7.0以上 開發(fā)工具:MyEclipse+Tomcat7.0+MySQL 在MyEclipse集成環(huán)境下進(jìn)行圖書管理員系統(tǒng)的界面設(shè)計(jì)和程序開發(fā),在系統(tǒng)的后臺(tái)采用MySQL作為數(shù)據(jù)庫(kù)支持,使用時(shí)打開瀏覽器。在地址欄中輸入網(wǎng)址回車后即可進(jìn)入圖書管理員系統(tǒng)的主頁(yè),進(jìn)行相應(yīng)的操作。二、

4、 系統(tǒng)需求分析2.1 任務(wù)概述1新書購(gòu)進(jìn)后,進(jìn)行分類、同一編碼和入庫(kù)。2學(xué)生借閱圖書后,記錄相關(guān)信息。3. 學(xué)生歸還時(shí),對(duì)比查看該書是否超期,超期后,按規(guī)定罰款。根據(jù)以上調(diào)查分析,給出業(yè)務(wù)流程圖,如圖:2.2 數(shù)據(jù)描述(數(shù)據(jù)流圖+數(shù)據(jù)字典) 經(jīng)過調(diào)查,我們了解了基本的業(yè)務(wù)程序,接下來給出系統(tǒng)的邏輯模型。構(gòu)造系統(tǒng)的邏輯模型的工具主要是數(shù)據(jù)流圖和數(shù)據(jù)字典,下面給出圖書館管理系統(tǒng)的基本模型,如圖: 根據(jù)基本模型,對(duì)其逐步細(xì)化,得到數(shù)據(jù)流圖,如圖: 根據(jù)系統(tǒng)流程圖,通過數(shù)據(jù)字典對(duì)數(shù)據(jù)進(jìn)一步描述:圖書:圖書表結(jié)構(gòu)描述:記錄圖書的相關(guān)信息定義:圖書信息表 圖書編號(hào)、圖書名稱、ISBN號(hào)、作者、出版社、類型

5、、價(jià)格、庫(kù)存量、副本存量、總量位置:LibWeb表空間借書登記:借書登記表結(jié)構(gòu)描述:記錄圖書的借閱信息定義:借閱登記表 借閱編號(hào)、學(xué)生編號(hào)、圖書編號(hào)、借閱時(shí)間、歸還時(shí)間、是否歸還位置:LibWeb表空間學(xué)生信息:學(xué)生信息表結(jié)構(gòu)描述:記錄學(xué)生信息定義:學(xué)生信息表 學(xué)生學(xué)號(hào)、學(xué)生姓名、性別、入校時(shí)間、畢業(yè)時(shí)間位置:LibWeb表空間歸還登記:歸還登記表結(jié)構(gòu)描述:記錄所有已歸還圖書的借閱情況定義:歸還信息表 編號(hào)、圖書名稱、歸還時(shí)間、歸還學(xué)生編號(hào)、歸還學(xué)生姓名位置:LibWeb數(shù)據(jù)空間用戶信息:用戶表結(jié)構(gòu)描述:記錄所有用戶定義:用戶信息表 賬號(hào)、真實(shí)姓名、密碼、描述位置:LibWeb數(shù)據(jù)空間角色信息

6、:角色表結(jié)構(gòu)描述:記錄所有角色定義:角色信息表 角色名稱、角色描述位置:LibWeb數(shù)據(jù)空間2.3 功能需求 經(jīng)過以上詳細(xì)的調(diào)查和分析,在數(shù)據(jù)流程和數(shù)據(jù)分析的基礎(chǔ)上,確定達(dá)到的功能為一下幾點(diǎn): 新書入庫(kù)登記:對(duì)與需求入庫(kù)的書籍,進(jìn)行數(shù)據(jù)登記,確認(rèn)后書籍入庫(kù)。 圖書信息的查詢和修改功能:當(dāng)圖書資料發(fā)生變化、當(dāng)圖書丟失,應(yīng)立即修改信息。 圖書借閱和歸還登記:學(xué)生借閱圖書時(shí)需要登記,學(xué)生歸還圖書時(shí)也需要登記。 學(xué)生的增加、修改、刪除等:新生入學(xué)時(shí)的信息和直接導(dǎo)入。 用戶的增加、修改、刪除等:用戶可根據(jù)權(quán)限來操作。 2.4 性能需求為了保證系統(tǒng)能夠長(zhǎng)期、高效、安全、穩(wěn)定、可靠的運(yùn)行,圖書館管理系統(tǒng)應(yīng)滿

7、足一下性能需求:1.系統(tǒng)處理數(shù)據(jù)的準(zhǔn)確性和及時(shí)性:系統(tǒng)處理的準(zhǔn)確性和及時(shí)性是系統(tǒng)的必要性能。在系統(tǒng)設(shè)計(jì)階段,就應(yīng)該充分考慮到,包括數(shù)據(jù)存儲(chǔ)量、訪問量等,是系統(tǒng)能夠滿足圖書管管理系統(tǒng)對(duì)數(shù)據(jù)的處理量。 2.系統(tǒng)的開放性和系統(tǒng)的可擴(kuò)充性:可擴(kuò)充性是系統(tǒng)健壯性的重要體現(xiàn),系統(tǒng)開發(fā)中應(yīng)充分考慮到系統(tǒng)的可擴(kuò)充性??蓴U(kuò)充性包括系統(tǒng)設(shè)計(jì)和測(cè)試階段的擴(kuò)充以及系統(tǒng)使用后的擴(kuò)充。任何系統(tǒng)在開發(fā)階段對(duì)需求都是完全明確的,即使系統(tǒng)交付使用后,用戶也會(huì)提出增加功能,所以,在系統(tǒng)設(shè)計(jì)階段就應(yīng)該考慮到系統(tǒng)的可擴(kuò)充性。3. 系統(tǒng)的易用性和易維護(hù)性:圖書館管理系統(tǒng)由圖書館管理員和學(xué)生使用,而使用者對(duì)系統(tǒng)結(jié)構(gòu)并不了解,這就要求系統(tǒng)

8、提供良好的用戶接口和友好的界面設(shè)計(jì)。要實(shí)現(xiàn)這一點(diǎn),要求操作簡(jiǎn)潔明了,數(shù)據(jù)校驗(yàn)通俗易懂。4. 系統(tǒng)的響應(yīng)速度:圖書管管理系統(tǒng)的響應(yīng)速度要求比較高,這就需要從一下幾個(gè)方面入手解決:校園網(wǎng)的帶寬、數(shù)據(jù)庫(kù)的快速穩(wěn)定、SQL語(yǔ)句執(zhí)行的高效率、瀏覽器的選擇。無論是哪方面,都會(huì)影響系統(tǒng)的響應(yīng)速度,所以,圖書館管理系統(tǒng)能夠擁有快速的響應(yīng)速度,必須做好其中的沒一點(diǎn)。三、 系統(tǒng)總體設(shè)計(jì)系統(tǒng)架構(gòu)設(shè)計(jì):本系統(tǒng)的整體架構(gòu)如圖所示,從邏輯上來看主要分為三層:模型層、控制層、視圖層。1.1 業(yè)務(wù)流程根據(jù)需求分析,以及反復(fù)的研究和探討,確認(rèn)其流程圖如下:根據(jù)流程圖,現(xiàn)具體功能描述如下:1.用戶登錄:系統(tǒng)對(duì)用戶的合法性進(jìn)行校驗(yàn)

9、,登錄后,系統(tǒng)會(huì)根據(jù)用戶所擁有的權(quán)限來分配權(quán)限。2.書籍入庫(kù):填寫書籍信息,可通過excel批量導(dǎo)入到數(shù)據(jù)庫(kù)中。3.圖書借閱:對(duì)已經(jīng)入庫(kù)的數(shù)據(jù),學(xué)生可借閱。4.圖書歸還:對(duì)已經(jīng)歸還的書籍進(jìn)行登記。5.管理措施:對(duì)定義系統(tǒng)規(guī)定的超期時(shí)間、超期處罰辦法、丟失賠償辦法。3.2 系統(tǒng)功能模塊圖依據(jù)需求分析階段得到的數(shù)據(jù)流圖,在保證系統(tǒng)基本功能的前提下,結(jié)合系統(tǒng)設(shè)計(jì)流程,給出系統(tǒng)功能模塊圖,如圖:3.3 系統(tǒng)的流程圖 四、詳細(xì)設(shè)計(jì)4.1 程序流程圖 該設(shè)計(jì)階段的任務(wù)是根據(jù)需求具體實(shí)現(xiàn)所需要的程序。經(jīng)過這個(gè)階段的設(shè)計(jì),應(yīng)該得出目標(biāo)系統(tǒng)的精確描述,從而在系統(tǒng)實(shí)現(xiàn)階段可以把這個(gè)描述直接翻譯某種程序設(shè)計(jì)語(yǔ)言書寫

10、的程序??傮w來說就是把各個(gè)模塊的細(xì)節(jié)加以描述。由于本系統(tǒng)采用的是j2ee來設(shè)計(jì)程序,java是面向?qū)ο蟮淖兂烧Z(yǔ)言,所以給出系統(tǒng)的主程序流程圖,如圖: 4.2 程序輸入輸出描述4.2.1 用戶角色模塊 1.輸入項(xiàng)目:用戶相關(guān)信息、角色相關(guān)信息 2.輸出項(xiàng)目:相應(yīng)的頁(yè)面4.2.2 學(xué)生管理模塊 1.輸入項(xiàng)目:用戶相關(guān)信息、角色相關(guān)信息 2.輸出項(xiàng)目:相應(yīng)的頁(yè)面4.2.3 圖書管理模塊 1.輸入項(xiàng)目:圖書相關(guān)信息 2.輸出項(xiàng)目:圖書信息4.2.4 借閱管理模塊 1.輸入項(xiàng)目:學(xué)生學(xué)號(hào)、圖書編號(hào) 2.輸出項(xiàng)目:借閱信息頁(yè)面4.2.5 歸還管理模塊 1.輸入項(xiàng)目:學(xué)生學(xué)號(hào)、圖書編號(hào) 2.輸出項(xiàng)目:歸還信

11、息頁(yè)面4.3 程序接口描述4.3.1 外部接口 由于該系統(tǒng)可以部署在任何操作系統(tǒng),且系統(tǒng)界面采用瀏覽器方式實(shí)現(xiàn),所以該系統(tǒng)是跨平臺(tái)、跨操作系統(tǒng)的。4.3.2 內(nèi)部接口通過面向?qū)ο蟪绦蛟O(shè)計(jì)模式實(shí)現(xiàn)低耦合高內(nèi)聚的程序設(shè)計(jì)思想,通過與數(shù)據(jù)庫(kù)之間的數(shù)據(jù)交換,實(shí)現(xiàn)對(duì)數(shù)據(jù)的處理和保存。4.4 數(shù)據(jù)庫(kù)的設(shè)計(jì)4.4.1 數(shù)據(jù)庫(kù)的邏輯設(shè)計(jì) 在需求階段已經(jīng)完成該系統(tǒng)所有的數(shù)據(jù)分析。根據(jù)該階段建立的概念模型,已經(jīng)得出滿足系統(tǒng)設(shè)計(jì)要求的幾個(gè)關(guān)系描述,該階段的主要工作就是把前一階段的成果轉(zhuǎn)化為具體的數(shù)據(jù)庫(kù)。下面給出概念結(jié)構(gòu)設(shè)計(jì)的E-R圖,如圖所示: 圖(一) 圖(二) 圖(三)實(shí)體:圖書(圖書編號(hào),書名,作者,出版社,

12、定價(jià),圖書類別,圖書ISBN號(hào),圖書存量)學(xué)生(學(xué)生學(xué)號(hào),學(xué)生姓名,性別,入校時(shí)間,畢業(yè)時(shí)間)用戶(用戶名,真實(shí)姓名,密碼,描述)角色(角色名,角色描述)序號(hào)字段名稱字段說明類型位數(shù)屬性備注1ididnumber19非空1bookId編號(hào)varchar50非空2name名稱Varchar100非空3ISBNISBNvarchar50可為空4author作者varchar100可為空5publisher出版商varchar100可為空6type類型number2可為空和數(shù)據(jù)字典相關(guān)7price價(jià)格number10可為空8storeQuan存量number10可為空9leftQuan副本存量num

13、ber10可為空10totleQuan總量number10可為空11createTime創(chuàng)建時(shí)間date非空12operateTime修改時(shí)間date可為空13creator創(chuàng)建者number19非空14operate操作人number19可為空15status狀態(tài)varchar1非空N or Y16version版本number非空 圖書信息表序號(hào)字段名稱字段說明類型位數(shù)屬性備注1id編號(hào)number10非空2userId用戶編號(hào)number10非空3bookId圖書編號(hào)varcher50非空4broTime結(jié)束時(shí)間date可為空5retime還書時(shí)間date可為空6ifReturn是否歸還

14、number1非空7createTime創(chuàng)建時(shí)間date非空8operateTime修改時(shí)間date可為空9creator創(chuàng)建者number19非空10operate操作人number19可為空11status狀態(tài)varchar1非空N or Y12version 圖書歸還登記表序號(hào)字段名稱字段說明類型位數(shù)屬性備注1ididnumber19非空2createTime創(chuàng)建時(shí)間date非空3operateTime修改時(shí)間date可為空4creator創(chuàng)建者number19非空5operate操作人number19可為空6status狀態(tài)varchar1非空N or Y7version版本numbe

15、r非空8name用戶名varchar60非空9relName真實(shí)姓名varchar60可為空11password密碼varchar64非空12description描述varchar1024可為空 用戶表序號(hào)字段名稱字段說明類型位數(shù)屬性備注1ididnumber19非空2createTime創(chuàng)建時(shí)間date非空3operateTime修改時(shí)間date可為空4creator創(chuàng)建者number19非空5operate操作人number19可為空6status狀態(tài)varchar1非空N or Y7version版本number非空8name角色名varchar32非空12descriptionvar

16、char1024非空 角色表序號(hào)字段名稱字段說明類型位數(shù)屬性備注1ididnumber19非空2createTime創(chuàng)建時(shí)間date非空3operateTime修改時(shí)間date可為空4creator創(chuàng)建者number19非空5operate操作人number19可為空6status狀態(tài)varchar1非空N or Y7version版本number非空8stuId學(xué)生編號(hào)varchar50非空12name學(xué)生姓名varchar100非空8sex性別number1非空12addTime入學(xué)時(shí)間date非空12endTime畢業(yè)時(shí)間date非空 學(xué)生表 圖書表 用戶表五、頁(yè)面設(shè)計(jì)及編碼實(shí)現(xiàn)UI頁(yè)面

17、設(shè)計(jì)系統(tǒng)登錄用戶注冊(cè)注冊(cè)成功圖書管理員登錄主界面編輯書目信息編輯書目信息刪除操作圖書管理參數(shù)維護(hù)主界面圖書管理參數(shù)編輯刪除操作圖書借閱審批主界面圖書借閱審批界面審批完成界面圖書類型管理主界面圖書類型編輯刪除操作圖書條碼管理主界面圖書條碼編輯刪除操作菜單管理主界面(系統(tǒng)管理)菜單編輯界面刪除操作角色管理主界面(系統(tǒng)管理)角色編輯界面刪除操作用戶管理主界面(系統(tǒng)管理)用戶編輯界面刪除操作用戶登錄圖書借閱查詢 1.系統(tǒng)的登錄設(shè)計(jì)與實(shí)現(xiàn) 基于系統(tǒng)的和數(shù)據(jù)的安全性考慮,所有用戶進(jìn)入系統(tǒng)之前必須經(jīng)過登錄頁(yè)面進(jìn)行合法性驗(yàn)證,身份驗(yàn)證成功之后才能進(jìn)入系統(tǒng)為每個(gè)用戶提供唯一的賬號(hào)和初始密碼,用戶輸入自己的用戶名

18、和密碼之后,點(diǎn)擊【完成】按鈕登錄系統(tǒng)。系統(tǒng)后臺(tái)會(huì)對(duì)用戶輸入的登錄信息進(jìn)行認(rèn)證,如果用戶名或者密碼不合法時(shí),后臺(tái)會(huì)返回錯(cuò)誤信息并在前端頁(yè)面上進(jìn)行顯示,提示用戶“用戶名或密碼不正確,請(qǐng)重新輸入!”注冊(cè)用戶,若信息已存在,注冊(cè)失敗,返回登錄頁(yè)面注冊(cè)用戶成功,返回登錄頁(yè)面登錄后主頁(yè)面示例代碼如下所示:1)注冊(cè)代碼:package servlet;import java.io.IOException;import java.io.PrintWriter;import java.sql.SQLException;import javax.servlet.ServletException;import ja

19、vax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import bean.userBean;import dao.user;public class ZhuceServlet extends HttpServlet /* * Constructor of the object. */public ZhuceServlet() super();/* * Destruction of the servlet.

20、<br> */public void destroy() super.destroy(); / Just puts "destroy" string in log/ Put your code here/* * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * param request the request send by the client to the

21、server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if an error occurred */public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException /* * The doPost method of t

22、he servlet. <br> * * This method is called when a form has its tag value method equals to post. * * param request the request send by the client to the server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if a

23、n error occurred */public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException String name=request.getParameter("name");String pwd=request.getParameter("pwd");user test=new user();try userBean user=test.check(name);if(user=null

24、)userBean user1=new userBean(name,pwd);test.register(user1);response.sendRedirect("ZhuceSuccess.jsp");elseresponse.sendRedirect("ZhuceError.jsp"); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();/* * Initialization of the servlet. <br> * * throws Se

25、rvletException if an error occurs */public void init() throws ServletException / Put your code here2)登陸代碼:package servlet;import java.io.IOException;import java.io.PrintWriter;import java.sql.SQLException;import java.util.List;import javax.servlet.ServletException;import javax.servlet.http.HttpServl

26、et;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import dao.library;import dao.user;import bean.libraryBean;import bean.userBean;public class LoginServlet extends HttpServlet /* * */private static final long serialVersionUID = 1L;/* * Constructor of the o

27、bject. */public LoginServlet() super();/* * Destruction of the servlet. <br> */public void destroy() super.destroy(); / Just puts "destroy" string in log/ Put your code here/* * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method

28、 equals to get. * * param request the request send by the client to the server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if an error occurred */public void doGet(HttpServletRequest request, HttpServletResponse r

29、esponse)throws ServletException, IOException response.setContentType("text/html");String name=request.getParameter("name");String pwd=request.getParameter("pwd");/userBean user = new userBean(name,pwd);user test=new user();try userBean user = test.check(name); if (user!

30、=null) if (pwd.equals(user.getPWD() library bookinfo=new library();/Dao涓殑library List<libraryBean> list=bookinfo.selectall(); request.getSession().setAttribute("list",list); / response.sendRedirect(request.getContextPath() + "InfoServlet"); request.getRequestDispatcher(&quo

31、t;InfoServlet").forward(request, response); else response.sendRedirect("error.jsp"); else response.sendRedirect("error.jsp"); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();/* * The doPost method of the servlet. <br> * * This method is called

32、when a form has its tag value method equals to post. * * param request the request send by the client to the server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if an error occurred */public void doPost(HttpServlet

33、Request request, HttpServletResponse response)throws ServletException, IOException response.setContentType("text/html"); doGet(request,response); /* * Initialization of the servlet. <br> * * throws ServletException if an error occurs */public void init() throws ServletException / Put

34、 your code here2.系統(tǒng)首頁(yè)設(shè)計(jì)及實(shí)現(xiàn)登錄后主頁(yè)面3.圖書管理模塊設(shè)計(jì)及實(shí)現(xiàn) 圖書管理員登錄系統(tǒng)后可以進(jìn)行圖書管理,圖書管理模塊包含了圖書增、刪、改、查管理和圖書管理參數(shù)等子功能。下面分別進(jìn)行介紹: 圖書的增、刪、改、查管理截圖如下所示: 1) 添加圖書信息2)刪除圖書信息 3)以圖書類應(yīng)編號(hào)為主鍵,修改圖書信息:4)輸入書名,查詢圖書信息:示例代碼如下所示:1) 增加代碼: package servlet;import java.io.IOException;import java.sql.SQLException;import javax.servlet.ServletExc

35、eption;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import bean.libraryBean;import dao.library;public class AddBookServlet extends HttpServlet /* * Constructor of the object. */public AddBookServlet() super();/* * De

36、struction of the servlet. <br> */public void destroy() super.destroy(); / Just puts "destroy" string in log/ Put your code herepublic void doPost(HttpServletRequest request, HttpServletResponse response) library library = new library();libraryBean book = new libraryBean(request.getPa

37、rameter("pubname"),request.getParameter("bookname"),Integer.parseInt(request.getParameter("typeid"),request.getParameter("author"), Integer.parseInt(request.getParameter("storage"), Integer.parseInt(request.getParameter("borrownum");try lib

38、rary.add(book);request.getRequestDispatcher("InfoServlet").forward(request, response); catch (ClassNotFoundException e) / TODO Auto-generated catch blocke.printStackTrace(); catch (Exception e) e.printStackTrace();/* * Initialization of the servlet. <br> * * throws ServletException i

39、f an error occurs */public void init() throws ServletException / Put your code here2) 刪除代碼: package servlet;import java.io.IOException;import java.io.PrintWriter;import java.sql.SQLException;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpSer

40、vletRequest;import javax.servlet.http.HttpServletResponse;import dao.library;public class DeleteServlet extends HttpServlet /* * Constructor of the object. */public DeleteServlet() super();/* * Destruction of the servlet. <br> */public void destroy() super.destroy(); / Just puts "destroy&

41、quot; string in log/ Put your code here/* * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * param request the request send by the client to the server * param response the response send by the server to the client * throws

42、 ServletException if an error occurred * throws IOException if an error occurred */public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException library library = new library();int i = Integer.parseInt(request.getParameter("typeid");try lib

43、rary.delete(i);request.getRequestDispatcher("InfoServlet").forward(request, response); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException / TODO Auto-ge

44、nerated method stubsuper.doPost(req, resp);/* * Initialization of the servlet. <br> * * throws ServletException if an error occurs */public void init() throws ServletException / Put your code here3) 修改代碼: package servlet;import java.sql.SQLException;import java.util.List;import javax.servlet.S

45、ervletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import bean.libraryBean;import dao.library;SuppressWarnings("serial")public class UpDateServlet extends HttpServlet /* * Constructor of the objec

46、t. */public UpDateServlet() super();/* * Destruction of the servlet. <br> */public void destroy() super.destroy(); / Just puts "destroy" string in log/ Put your code herepublic void doGet(HttpServletRequest request, HttpServletResponse response)Integer id = Integer.parseInt(request.g

47、etParameter("typeid");library library = new library();try List<libraryBean> book = library.getForValue(id);System.out.println(book);request.setAttribute("book", book);request.getRequestDispatcher("/UpDate.jsp").forward(request, response); catch (Exception e) / TOD

48、O Auto-generated catch blocke.printStackTrace(); /* * Initialization of the servlet. <br> * * throws ServletException if an error occurs */public void init() throws ServletException / Put your code here4) 查詢代碼: package servlet;import java.io.IOException;import java.sql.SQLException;import java

49、x.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import bean.libraryBean;import dao.library;public class EditServlet extends HttpServlet /* * Constructor of the object. */public EditServlet() super();/* * Destruction of the servlet. <br> */public void destroy() super.destroy(); / Just puts "destroy" string in log/ Put your code herepublic void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException library

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論