【正文】
表的結(jié)構(gòu)設(shè)計(jì) ? 新聞公告信息表( bulletin)。需要用到圖書(shū)管理員表和學(xué)生信息表。 表 32 學(xué)生信息表 字段名 描述 類(lèi)型 長(zhǎng)度 是否主鍵 stud_no 學(xué)生學(xué)號(hào) int 4 是 stud_name 學(xué)生姓名 varchar 50 否 stud_password 學(xué)生登錄時(shí)密碼 char 20 否 stud_tel 學(xué)生電話(huà)號(hào)碼 varchar 50 否 stud_ 學(xué)生電子郵件 varchar 50 否 stud_yearid 學(xué)生入學(xué)年份 int 4 否 stud_dept 學(xué)生所屬于院部 varchar 50 否 stud_dormit 學(xué)生宿舍 varchar 50 否 ? 圖書(shū)管理員信息表 (admin) 學(xué)生信息表的結(jié)構(gòu)如表 33 所示。 ? 學(xué)生信息表:存放學(xué)生的基本信息的表。 表的關(guān)系如圖 31 所示。 表 36 借閱信息表 字段名 描述 類(lèi)型 長(zhǎng)度 是否主鍵 book_id 圖書(shū)編號(hào) int 4 是 borrow_day 借閱時(shí)間 varchar 50 否 card_id 借閱證號(hào) int 4 否 圖書(shū)修改模塊數(shù)據(jù)庫(kù)設(shè)計(jì) 1) 數(shù)據(jù)庫(kù)設(shè)計(jì)的需求分析 在一個(gè)圖書(shū)管理系統(tǒng)中,對(duì)圖書(shū)的修改只能由圖書(shū)管理員來(lái)操作,所以設(shè)計(jì)了一個(gè)管理員權(quán)限。 15 ? 圖書(shū)管理員表 :用于存放管理員的帳號(hào)的表,包括管理員的管理員姓名,管理員 ID 號(hào),登錄密碼。 ? 圖書(shū)借閱信息表:存放了學(xué)生借閱圖書(shū)的信息,包括學(xué)生借書(shū)證號(hào),圖書(shū)編號(hào),借閱日期。 ? 學(xué)生借閱證表( card) 16 借閱證表的結(jié)構(gòu)如上表 35 所示。普通用戶(hù)具有最初級(jí)的權(quán)限。 圖書(shū)公告從數(shù)據(jù)庫(kù)在讀入,并按時(shí)間顯示最近發(fā)布的 10條圖 書(shū)信息。點(diǎn)擊此圖書(shū)圖片時(shí)會(huì)從數(shù)據(jù)庫(kù)中查詢(xún)到有關(guān)該本圖書(shū)的資料信息,也可以根據(jù)需求查閱該類(lèi)圖書(shū)的信息。)。 } 學(xué)生界面的設(shè)計(jì) 當(dāng)學(xué)生登錄后會(huì)跳轉(zhuǎn)到學(xué)生具有操作的頁(yè)面,包括學(xué)生個(gè)人信息的修改與借閱圖書(shū)的查詢(xún) 。在頁(yè)面上利用一個(gè) session 對(duì)象的 getAttribute 方法來(lái)獲得學(xué)生的學(xué)號(hào)和姓名。管理員登錄時(shí),把管理員的信息存儲(chǔ)在 session里。在傳輸修改信息之前傳輸一個(gè)查詢(xún)語(yǔ)句來(lái)驗(yàn)證 主鍵存在。 ? 借 閱 證 辦 理 : 辦 理 借 閱 證 之 前 先 獲 取 管 理 員 的 帳 號(hào) ,Admin_id==null,返回 0,否則返回 1。 (admin_id) 21 If(admin_id==null) Return 0 Else{ Selec t Colname from Table w here Condition If (()) Insert into Table values( Colvalues) } 辦理借閱證頁(yè)面如圖 45 所示。 實(shí)現(xiàn)代碼如下: select * from card where stud_no=39。+stud_no+39。 ? 實(shí)現(xiàn)學(xué)生(管理員)登錄就是驗(yàn)證用戶(hù)所輸入的信息是否存在于數(shù)據(jù)庫(kù)相應(yīng)的表中。 實(shí)現(xiàn)效果圖如 47 所示 圖 47 用戶(hù)登錄頁(yè)面 23 查詢(xún)模塊 查詢(xún)模塊分為三部分,即三種權(quán)限下的查詢(xún):未登錄用戶(hù),學(xué)生登錄后的查詢(xún),管理員登錄的查詢(xún)。 查詢(xún)功能是由 SQL 的 Select 語(yǔ)句來(lái)實(shí)現(xiàn)。如圖 48 所示。%+keyword1+%39。登錄信息用 session 對(duì)象保存學(xué)生的登錄學(xué)號(hào)。這便于管理員對(duì)于圖書(shū)的管理。當(dāng)每次對(duì)圖書(shū)數(shù)據(jù)進(jìn)行修改時(shí)首先先獲取保存的 session 對(duì)象,只有在 session 對(duì)象的值存在時(shí)才能對(duì)圖書(shū)進(jìn)行管理。實(shí)現(xiàn)語(yǔ)句如下: Select * from book where book_id=39。 Insert into borrowinfo values(39。 39。當(dāng)存在時(shí),從圖書(shū)借閱表中刪除該條借閱信息并把還書(shū)的信息添加到還書(shū)信息表中 (returninfo)。 and card_id=39。 and card_id=39。 26 歸還頁(yè)面如圖 411 所示。+book_id+39。實(shí)現(xiàn)語(yǔ)句如下: Select * from book where book_id=39。39。利用一個(gè) JspSmartUpload 包來(lái)實(shí)現(xiàn)圖書(shū)的上傳下載功能。 // 上傳初始化 (10000000)。 //上傳文件 req = ()。 //設(shè)定 上傳路徑 String trace = aa + myfilename。 If(()) { Select book_stock from book where book_id=39。 } Else Insert into book values(colvalues) 如圖 415 所示 圖 415 新圖書(shū)入庫(kù)頁(yè)面 29 系統(tǒng)其他功能設(shè)計(jì) 1) 系統(tǒng)時(shí)間設(shè)計(jì) 系統(tǒng)時(shí)間在每個(gè) WEB 網(wǎng)站中都會(huì)出現(xiàn)。 datestr = (new ()) 。因?yàn)間etYear()方法所獲得年份為當(dāng)前年份減去 1900,所有在 getYear()之后必須再加上 1900。 int day=()。如 何計(jì)算某學(xué)生借閱某本圖書(shū)多少天很值得去研究。如下: int[] m=new int[]{0,31,60,91,121,152,182,213,244,274,305,335,366}。year%100!=0) 30 計(jì)算兩個(gè)日期之間天數(shù)時(shí),再次判斷這兩個(gè)日期是否是同一年份。這時(shí)采用分頁(yè)技術(shù),可以讓每頁(yè)只顯示 5 個(gè)或 10 個(gè)記錄等,用戶(hù)要看更多的數(shù)據(jù)時(shí)只要選擇自己想要查看的頁(yè)數(shù)編號(hào)就可以了。 分頁(yè)技術(shù)的核心代碼如下: int PageSize=10。 //待顯示頁(yè)碼 rs=(sql)。 //獲取要顯示的頁(yè)面 32 ((ShowPage1)*PageSize+1)。在每個(gè)功能上找一個(gè)用戶(hù)作為測(cè)試人員,讓他隨意的輸入數(shù)據(jù),直到出現(xiàn)問(wèn)題。 圖書(shū)系統(tǒng)的測(cè)試 本系統(tǒng)是 web 一個(gè)網(wǎng)站,在編碼完成后,我從網(wǎng)站 界面、數(shù)據(jù)錄入、模塊功能和性能進(jìn)行了相應(yīng)的測(cè)試,通過(guò)以上的各項(xiàng)測(cè)試,可以保證系統(tǒng)的正常運(yùn)行。其次頁(yè)面的超鏈接比較多,測(cè)試看看有沒(méi)有超鏈地址寫(xiě)錯(cuò)的地方??紤]頁(yè)面在各種分辨率計(jì)算機(jī)上顯示的效果等等。比如: ID 輸入只能輸入數(shù)字;當(dāng)不可以輸入時(shí),數(shù)據(jù)是無(wú)法錄入的。 系統(tǒng)的部署 數(shù)據(jù)庫(kù)的部署 將 解 壓 出來(lái) 的 數(shù)據(jù) 庫(kù) 文件 放 到相 應(yīng) 的物 理 路徑 中 ( C:\Program Files\Microsoft SQL Server\MSSQL\Data)。 2. 與 的配置 在“我的電腦”屬性下的環(huán)境變量中設(shè)置 的 CLASSPATH .。 2. Lending management,: Including books and returned。jsp。s mainly made up of three parts of customer end browser, Web server and database server, it is typical Browser/Server structure. This text is a detailed introduction, in order to draw support from JSP strong database access ability, procedure is it bee simple and easy fast to work out, and can the security system have better performance, adopt and develop ripe JSP technology, use the script language that JavaScript are easily understood, and then bine HTML code and utilize web database thesis includes The Foreword, The Lesson Background, The Related Theories, The Feasibility Analysis and Argument and so on, The Demand Analysis, The Outline Designed, The Detail Designed, The Test and Result,etc. XML document standards and the emergence of a relational database has problems, twodimensional sheet data to access SQL and XML based on the bination and became one of the road. As a result, long SQL / XML 37 bination trip started When XML launched five years ago, it has rewritten the rules of data management arising from the prospect of a relational database vendors attention, but they did not panic. Experienced 10 years ago on this scene, when people object database has been given the role of paradigm shift. This new software is true that there are norms, and the lasting popularity of the concept: that no effort will be able to switch between preservation and retrieval form programming language objects capacity. But the result is that RDBMS Institute of the new trick, that is, to find ways of making use of SQL: 1999 object model plex data types preservation solution. We have already had used relational database and object database JDO (Java Data Objects) applications. Long SQL / XML trip with the first step is to relational data as XML format release. Published XML is a logical starting point because it can easily represent XML in SQL result sets, because so many dynamic Web pages are provided by the SQL query. Asked to use the traditional method of collection procedures and the oute of the visit by procedures Construction website. In a pletely new method of producing the manner as prescribed by dynamic Web pages, using SQLtoXML data for generating XML, and use XSLT (Extensible Stylesheet Language Conversion) into XML to majority of enterprises in the information stored in document storage, rather than relational databases. These documents will be entered into the database of the reasons for the existence, that is, centralized management and fulltext search, but in the absence of a document to the data in the database and the data in the establishment of relations between the methods of circumstances, these