【正文】
功能。上傳代碼如下: SmartUpload su = new SmartUpload()。 // 上傳初始化 (10000000)。 (jpg,gif,png,)。 //上傳文件 req = ()。//獲取文件 String myfilename = ()。 //設定 上傳路徑 String trace = aa + myfilename。 //存到這個目錄里 插入圖書信息實現(xiàn)語句如下: Select * from book where book_id=39。 If(()) { Select book_stock from book where book_id=39。 Book_stock2=book_stock+book_stock1 //book_stock 為輸入的圖書數(shù)量 Update book set book_stock=book_stock2 where book_id=39。 } Else Insert into book values(colvalues) 如圖 415 所示 圖 415 新圖書入庫頁面 29 系統(tǒng)其他功能設計 1) 系統(tǒng)時間設計 系統(tǒng)時間在每個 WEB 網(wǎng)站中都會出現(xiàn)。圖書管理系統(tǒng)中,首頁會調用一個系統(tǒng)當前時間顯示出來。 datestr = (new ()) 。 獲 取 系 統(tǒng) 當 前 時 間 調 用 JAVA API 中的 DATE 類 。因為getYear()方法所獲得年份為當前年份減去 1900,所有在 getYear()之后必須再加上 1900。具體實現(xiàn)方法如下: int year=1900+()。 int day=()。然后重寫一個 toString()方法來把獲得的系統(tǒng)時間用一個 String 字符串添加到數(shù)據(jù)庫中。如 何計算某學生借閱某本圖書多少天很值得去研究。這使得計算兩天相隔天數(shù)來顯得比較麻煩。如下: int[] m=new int[]{0,31,60,91,121,152,182,213,244,274,305,335,366}。 判斷一個年份是否為閏年: year%400==0||(year%4==0amp。year%100!=0) 30 計算兩個日期之間天數(shù)時,再次判斷這兩個日期是否是同一年份。學生就可以方便的知道自己借閱了多少天,管理員也可以借閱的天數(shù)知道該學生借閱的圖書是否過期。這時采用分頁技術,可以讓每頁只顯示 5 個或 10 個記錄等,用戶要看更多的數(shù)據(jù)時只要選擇自己想要查看的頁數(shù)編號就可以了。每當查詢數(shù)據(jù)庫時候,總是從數(shù)據(jù)庫中的第一個記錄查起。 分頁技術的核心代碼如下: int PageSize=10。 //記錄總數(shù) int PageCount=0。 //待顯示頁碼 rs=(sql)。 //光標在最后一行 RecordCount=()。 //獲取要顯示的頁面 32 ((ShowPage1)*PageSize+1)。如果要給軟件測試下一個定義,可以這樣講,軟件測試是為了發(fā)現(xiàn)錯誤而執(zhí)行程序的過程。在每個功能上找一個用戶作為測試人員,讓他隨意的輸入數(shù)據(jù),直到出現(xiàn)問題。通過后期修改來完善程序。 圖書系統(tǒng)的測試 本系統(tǒng)是 web 一個網(wǎng)站,在編碼完成后,我從網(wǎng)站 界面、數(shù)據(jù)錄入、模塊功能和性能進行了相應的測試,通過以上的各項測試,可以保證系統(tǒng)的正常運行。 圖書系統(tǒng)的 WEB頁面測試 對網(wǎng)頁界面進行測試,就是檢查程序運行時,界面中是否有錯別字,表述不妥的標題、標簽,或一些動態(tài)顯示的畫面是否正常。其次頁面的超鏈接比較多,測試看看有沒有超鏈地址寫錯的地方。若用絕對地址,在換個環(huán)境的情況下很容易出現(xiàn)圖片讀取不了的情況??紤]頁面在各種分辨率計算機上顯示的效果等等。目的是盡量防止錄入非法數(shù)據(jù)。比如: ID 輸入只能輸入數(shù)字;當不可以輸入時,數(shù)據(jù)是無法錄入的。特別是基本數(shù)據(jù)類型與String 的區(qū)別。 系統(tǒng)的部署 數(shù)據(jù)庫的部署 將 解 壓 出來 的 數(shù)據(jù) 庫 文件 放 到相 應 的物 理 路徑 中 ( C:\Program Files\Microsoft SQL Server\MSSQL\Data)。 2. 右 擊“數(shù)據(jù)庫”→“附加數(shù)據(jù)庫”( C:\Program Files\Microsoft SQLServer\MSSQL\Data\)→點擊“確定”完成數(shù)據(jù)庫創(chuàng)建。 2. 與 的配置 在“我的電腦”屬性下的環(huán)境變量中設置 的 CLASSPATH .。C:\Program Files\Apache Software Foundation\Tomcat \lib\ 35 附錄:英文技術資料翻譯 英文原文: LIBRARY MANAGEMET SYSTEM AND JSP+XML+SQL The 21st century will be the information society, the information took the social most main resources, will bee the strategic resources to arouse the people widespread gains the information? The books are we best gain information ways,the books is humanity39。 2. Lending management,: Including books and returned。 4 Book. Lending certificate management, This part is the loan certificate management 。jsp。s life with, there is more and more application of Web database , such as emerce system, work books administrative system ,etc. JSP is dynamic Web technology, it not only can carry on plicated databaseoperation, and the page produced has very strong interaction, allow it convenient and control and manage the data, it realizes visit to database through JDBC, including add, delete, upgrade , inquire. Web database technology,especially important technology is web dynamic technology, with inquiring technology interactivly dynamically of backstage supporter39。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