javaweb簡(jiǎn)單的圖書(shū)管理系統(tǒng)_第1頁(yè)
javaweb簡(jiǎn)單的圖書(shū)管理系統(tǒng)_第2頁(yè)
javaweb簡(jiǎn)單的圖書(shū)管理系統(tǒng)_第3頁(yè)
javaweb簡(jiǎn)單的圖書(shū)管理系統(tǒng)_第4頁(yè)
javaweb簡(jiǎn)單的圖書(shū)管理系統(tǒng)_第5頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余12頁(yè)可下載查看

下載本文檔

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

文檔簡(jiǎn)介

1、實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)課程:Web應(yīng)用開(kāi)發(fā)學(xué)生姓名:學(xué)號(hào):專業(yè)班級(jí):2018年6月18日電南昌大學(xué)實(shí)驗(yàn)報(bào)告學(xué)生姓名:學(xué)號(hào):專業(yè)班級(jí):實(shí)驗(yàn)類型:口驗(yàn)證綜合口設(shè)計(jì)創(chuàng)新實(shí)驗(yàn)日期:實(shí)驗(yàn)成績(jī):一、實(shí)驗(yàn)項(xiàng)目名稱Web應(yīng)用開(kāi)發(fā)綜合訓(xùn)練二、實(shí)驗(yàn)?zāi)康暮鸵笫褂?Java+JSP+Servle肢術(shù),選用 EL、JSTL、Struts、Hibernate myBatis、jQuery 等技術(shù),開(kāi)發(fā)一個(gè)基本 Web的應(yīng)用程序,以達(dá)到掌握 Web應(yīng)用開(kāi)發(fā)的基本原理、具備 使用Java+JSP+Servle肢術(shù)結(jié)合流行11架技術(shù)開(kāi)發(fā)Web應(yīng)用程序的能力,從而提升學(xué) 生的Web編程能力。要求學(xué)生自選題目,開(kāi)發(fā)一個(gè)模擬的 Web應(yīng)用程

2、序。可以一人一題,也可以多人 一題。但是每人必須單獨(dú)完成動(dòng)態(tài) Web頁(yè)面10頁(yè)以上。要求學(xué)生根據(jù)需求描述獨(dú)自完成需求分析, 軟件設(shè)計(jì)、程序模塊設(shè)計(jì)以及程序的編 寫(xiě)、調(diào)試和測(cè)試。設(shè)計(jì)和程序完成后,要求根據(jù)指定的格式要求,獨(dú)自完成設(shè)計(jì)報(bào)告的撰寫(xiě)。三、實(shí)驗(yàn)基本情況本實(shí)訓(xùn)要求根據(jù)下述需求陳述寫(xiě)出需求分析文本并進(jìn)行軟件開(kāi)發(fā),并列出源代碼和運(yùn)行結(jié)果。四、需求分析項(xiàng)目介紹這是一個(gè)簡(jiǎn)單的圖書(shū)管理系統(tǒng),由一個(gè)管理員來(lái)實(shí)現(xiàn)對(duì)用戶的刪除,圖書(shū)的增加,修改 和圖書(shū)的刪除功能,用戶注冊(cè)登錄后可以實(shí)現(xiàn)對(duì)圖書(shū)的借閱和歸還。 由于時(shí)間關(guān)系在設(shè) 計(jì)項(xiàng)目時(shí)有很多不好的地方,未來(lái)得及修改,在管理員登錄界面采用了圖形驗(yàn)證碼, 由 于

3、是同樣的技術(shù),在用戶登錄界面就沒(méi)有采用圖形驗(yàn)證技術(shù)。功能需求1 .用戶注冊(cè)2 .圖書(shū)添加3 .圖書(shū)修改4 .用戶管理5 .圖書(shū)借閱6 .歸還圖書(shū)五、軟件設(shè)計(jì)ER 圖 程序流程數(shù)據(jù)庫(kù)設(shè)計(jì)模塊設(shè)計(jì)及運(yùn)行結(jié)果項(xiàng)目整體采用 MVC模式,整體上運(yùn)用jsp+javabean+servlet+jdbc+daq每個(gè)jsp頁(yè)面采 用jQuery技術(shù)作為背景,實(shí)現(xiàn)簡(jiǎn)單的動(dòng)態(tài)背景,部分頁(yè)面運(yùn)用EL、JSTL、js中的點(diǎn)擊事件、Bootsrap圖形驗(yàn)證碼、分頁(yè)技術(shù)以及郵箱頁(yè)面。六、源代碼1 .用戶類User.Javapackage vo;publicclass Userprivate String name, pwd

4、;public StringgetName() return name;publicvoid setName(Stringname) this . name=name;public StringgetPwd() return pwd;publicvoid setPwd(Stringpwd) this . pwd=pwd; 2 .圖書(shū)類bookinfo.javapackage vo;publicclass bookinfo private String bno , bname, author , price , other ;public StringgetBno() return bno ;p

5、ublicvoid setBno(Stringbno) this . bno =bno;public StringgetBname()return bname;publicvoid setBname(Stringbname) this . bname=bname;public StringgetAuthor() return author ;publicvoid setAuthor(Stringauthor) this . author =author;public StringgetPrice() return price ;publicvoid setPrice(Stringprice)

6、this . price =price;public StringgetOther() return other ;publicvoid setOther(Stringother) this . other =other;3 .借書(shū)信息類package vo;publicclass lendbook , otherprivate String username , bno , bname, author , price public StringgetUsername()return username ;publicvoid setUsername(Stringuse

7、rname) this . username =username;public StringgetBno() return bno ;publicvoid setBno(Stringbno) this . bno =bno;public StringgetBname() return bname;publicvoid setBname(Stringbname) this . bname=bname;public StringgetAuthor() return author ;publicvoid setAuthor(Stringauthor) this . author =author;pu

8、blic StringgetPrice() return price ;publicvoid setPrice(Stringprice) this . price =price;public StringgetOther() return other ;publicvoid setOther(Stringother) this . other =other;4 .用戶功能UserDao.javapackagedao;importjava.sql.*;importvo.bookinfo;importvo.User;importvo.lendbook;importdbc.JdbcUtil;publ

9、icclassUserDaopublicvoidadd(Useruser)throwsException/ 添加用戶Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.getConnection();Stringsql="insertintouservalues(,)"ps=conn.prepareStatement(sql);ps.setString(1,user.getName();ps.setString(2,user.getPwd();ps.executeUpdate();finallyJdbc

10、Util.free(null,ps,conn);添加圖書(shū)publicvoidadd_book(bookinfobook)throwsException/Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.getConnection();Stringsql="insertintobook_infovalues(,)"ps=conn.prepareStatement(sql);ps.setString(1,book.getBno();ps.setString(2,book.getBname();ps.set

11、String(3,book.getAuthor();ps.setString(4,book.getPrice();ps.setString(5,book.getOther();ps.executeUpdate();finallyJdbcUtil.free(null,ps,conn);借出圖書(shū)publicvoidlend_book(lendbookbook)throwsException/Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.getConnection();Stringsql="insertintol

12、endbookvalues(,)"ps=conn.prepareStatement(sql);ps.setString(1,book.getUsername();ps.setInt(2,Integer.parseInt(book.getBno();ps.setString(3,book.getBname();ps.setString(4,book.getAuthor();ps.setString(5,book.getPrice();ps.setString(6,book.getOther();ps.executeUpdate();finallyJdbcUtil.free(null,p

13、s,conn);publicList<User>QueryAll()throwsException/ 列出全部用戶Connectionconn=null;PreparedStatementps=null;ResultSetrs=null;List<User>userList=newArrayList<User>(); try conn=JdbcUtil.getConnection();Stringsql="select*fromuser"ps=conn.prepareStatement(sql);rs=ps.executeQuery();

14、while(rs.next()Useruser=newUser();user.setName(rs.getString(1);user.setPwd(rs.getString(2);userList.add(user);finallyJdbcUtil.free(rs,ps,conn);returnuserList;publicvoiddelete(Stringbookno)throwsException/ 刪除圖書(shū)Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.getConnection();Stringsql=&qu

15、ot;deletefrombook_infowherebno="ps=conn.prepareStatement(sql);ps.setString(1,bookno);ps.executeUpdate();finallyJdbcUtil.free(null,ps,conn);publicvoidreturnbook(Stringbno,Stringusername)throwsException/ 歸還圖書(shū)Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.getConnection();Stringsql=&

16、quot;deletefromlendbookwherebno=andusername="ps=conn.prepareStatement(sql);ps.setString(1,bno);ps.setString(2,username);ps.executeUpdate();finallyJdbcUtil.free(null,ps,conn);publicvoiddelete_user(Stringusername)throwsException/ 刪除用戶Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.g

17、etConnection();Stringsql="deletefromuserwherename="ps=conn.prepareStatement(sql);ps.setString(1,username);ps.executeUpdate();finallyJdbcUtil.free(null,ps,conn);publicintgetPageCount()throwsException/ 分頁(yè)Connectionconn=null;PreparedStatementps=null;ResultSetrs=null;intrecordCount=0,t1=0,t2=0

18、;tryconn=JdbcUtil.getConnection();Stringsql="selectcount(*)frombook_info"ps=conn.prepareStatement(sql);rs=ps.executeQuery();rs.next();recordCount=rs.getInt(1);t1=recordCount%5;t2=recordCount/5;finallyJdbcUtil.free(null,ps,conn);returnt1=0t2:t2+1;publicList<bookinfo>QueryAll_book(intp

19、ageNo)throwsException/ 列出全部圖書(shū)Connectionconn=null;PreparedStatementps=null;ResultSetrs=null;intpageSize=5;intstartRecno=(pageNo-1)*pageSize;List<bookinfo>bookList=newArrayList<bookinfo>();tryconn=JdbcUtil.getConnection();Stringsql="select*frombook_infoorderbybnolimit,"ps=conn.pr

20、epareStatement(sql);ps.setInt(1,startRecno);ps.setInt(2,pageSize);rs=ps.executeQuery();while(rs.next()bookinfobook=newbookinfo();book.setBno(rs.getString(1);book.setBname(rs.getString(2);book.setAuthor(rs.getString(3);book.setPrice(rs.getString(4);book.setOther(rs.getString(5);bookList.add(book);fin

21、allyJdbcUtil.free(rs,ps,conn);returnbookList;publicList<lendbook>QueryAll_lendbook(Stringusername)throwsException/ 列出已借圖書(shū)Connectionconn=null;PreparedStatementps=null;ResultSetrs=null;List<lendbook>bookList=newArrayList<lendbook>();tryconn=JdbcUtil.getConnection();Stringsql="se

22、lect*fromlendbookwhereusername="ps=conn.prepareStatement(sql);ps.setString(1,username);rs=ps.executeQuery();while(rs.next()lendbookbook=newlendbook();book.setUsername(rs.getString(1);book.setBno(rs.getString(2);book.setBname(rs.getString(3);book.setAuthor(rs.getString(4);book.setPrice(rs.getStr

23、ing(5);book.setOther(rs.getString(6);bookList.add(book);finallyJdbcUtil.free(rs,ps,conn);returnbookList;publicvoidmodify_book(bookinfobook)throwsException/ 修改圖書(shū)Connectionconn=null;PreparedStatementps=null;tryconn=JdbcUtil.getConnection();Stringsql="updatebook_infosetbname=,author=,price=,other=

24、wherebno="ps=conn.prepareStatement(sql);ps.setString(1,book.getBname();ps.setString(2,book.getAuthor();ps.setString(3,book.getPrice();ps.setString(4,book.getOther();ps.setString(5,book.getBno();ps.executeUpdate();finallyJdbcUtil.free(null,ps,conn);5 .獲取表格值代碼:function getTableContent(node)varvar

25、 name=tr1.cells0.innerText;"<%=path %>delete_username="+name;alert(name);)7 .背景jQuery代碼由于代碼過(guò)長(zhǎng),不展示;七、運(yùn)行結(jié)果1 .管理員登錄頁(yè)面:管理員登錄界面采用簡(jiǎn)單的CSS、 jQuery 、以及圖形驗(yàn)證碼,當(dāng)圖形驗(yàn)證碼輸入不正確以及賬號(hào)密碼輸入不正確會(huì)出現(xiàn)相相應(yīng)提示, 同時(shí)點(diǎn)擊相信的輸入框, 提示輸入對(duì)應(yīng)類型的背景字體會(huì)消失, 當(dāng)鼠標(biāo)點(diǎn)擊其他地方時(shí)會(huì)相應(yīng)出現(xiàn), 采用的是placeholder屬性,我們平時(shí)單純的html的輸入框以及提交的按鈕,讓人感覺(jué)不是很 舒適,采用簡(jiǎn)單的

26、CSS將他們的邊框去除,然后加上相應(yīng)的邊框。2 .登錄主界面:導(dǎo)航欄感謝bootstrap開(kāi)源,運(yùn)用了始終懸浮在頂部的導(dǎo)航欄,奈何頁(yè)面長(zhǎng)度有限不能向下滾動(dòng), 無(wú)法看出這一功能, 頁(yè)面內(nèi)容由于思維過(guò)于局限, 暫時(shí)沒(méi)有想出用什么內(nèi)容來(lái)填充, 只想到類似于積分的東西, 這一內(nèi)容在以后會(huì)作出改進(jìn), 目前只有一個(gè)大概的模板,同時(shí)在改變頁(yè)面的分辨率時(shí)導(dǎo)航欄中的功能選項(xiàng)會(huì)變成一個(gè)按鈕,用一個(gè)<nva>便簽來(lái)裝載, 本頁(yè)也有一個(gè)亮點(diǎn)便是響應(yīng)式, 在改變分辨率時(shí)板塊并不會(huì)發(fā)生錯(cuò)亂的現(xiàn)象, 運(yùn)用柵格系統(tǒng)思想, 在第二張圖張可以看到效果, 由于調(diào)各種分辨率國(guó)語(yǔ)繁瑣, 所以這一技術(shù)只在兩個(gè)頁(yè)面運(yùn)用到,以后

27、有時(shí)間會(huì)加以改善。3 .管理用戶頁(yè)面:點(diǎn)擊管理用戶的小便簽會(huì)出現(xiàn)用戶的列表,點(diǎn)擊刪除用戶可以將用戶從數(shù)據(jù)庫(kù)中刪除,同時(shí)頁(yè)面中的幾個(gè)小符號(hào)也是運(yùn)用 bootstrap 中的組件, 給人以更直觀清楚的描述功能,在本頁(yè)面我并沒(méi)有采用分頁(yè)技術(shù), 但是在后面幾個(gè)頁(yè)面中有采用分頁(yè)技術(shù), 在做頁(yè)面的時(shí)候并沒(méi)有考慮到有很多的用戶, 只是用幾個(gè)來(lái)驗(yàn)證, 所以就沒(méi)有用分頁(yè)技術(shù), 在這個(gè)點(diǎn)擊就刪除的技術(shù)上一開(kāi)始遇到了難題, 并不知道怎么樣去些控制的后臺(tái), 后來(lái)在頁(yè)面中運(yùn)用了 js 的技術(shù),可以利用表格的結(jié)點(diǎn)來(lái)獲取每個(gè)表格單元格的內(nèi)容,再將按鍵設(shè)置為this,點(diǎn)擊便是獲取當(dāng)前行的值,并傳到servlet中調(diào)用dao中刪除用戶的函數(shù),便實(shí)現(xiàn)了。同時(shí)利用 js 的鼠標(biāo)事件,鼠標(biāo)移動(dòng)到當(dāng)前行時(shí)會(huì)改變顏色。4

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 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)論