javaWeb書店管理系統(tǒng)_第1頁(yè)
javaWeb書店管理系統(tǒng)_第2頁(yè)
javaWeb書店管理系統(tǒng)_第3頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余16頁(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)?zāi)康?)理解并掌握編碼與測(cè)試相關(guān)理論與方法;2)進(jìn)一步熟悉利用編程語(yǔ)言實(shí)現(xiàn)系統(tǒng);3)要求學(xué)生理解測(cè)試在軟件開發(fā)中的重要地位;4)學(xué)生了解測(cè)試用例與測(cè)試報(bào)告的相關(guān)書寫規(guī)范。二、實(shí)驗(yàn)內(nèi)容與要求1)根據(jù)系統(tǒng)的特點(diǎn),選取 javaWeb MVC 開發(fā)模型實(shí)現(xiàn)該系統(tǒng);2)系統(tǒng)的編碼結(jié)構(gòu):邊界類:1個(gè)html (項(xiàng)目首頁(yè)),13個(gè)jsp (中間跳轉(zhuǎn)的頁(yè)面),一個(gè)css (界面 美化功能),一個(gè) javascript (控制輸入合法性)??刂祁悾阂粋€(gè) servlet 類(連接邊界類和實(shí)體類)實(shí)體類:一個(gè) datebase 類(連接數(shù)據(jù)庫(kù)),一個(gè) bookinfo 類(書本的增刪檢查 操作)服務(wù)器采用

2、 tomcat 。如下圖展示:3)對(duì)系統(tǒng)進(jìn)行測(cè)試分析,并對(duì)系統(tǒng)功能實(shí)施測(cè)試,編寫測(cè)試用例,系統(tǒng)已經(jīng)實(shí)現(xiàn)可以讓手機(jī)電腦一起訪問(wèn)并做操作;4)撰寫實(shí)驗(yàn)報(bào)告,同時(shí)需要了解測(cè)試報(bào)告相應(yīng)的規(guī)范與寫法。1. 下面是一些界面的 展示 (沒有全部展示):登錄頁(yè)面顧客首頁(yè)購(gòu)買頁(yè)面訂單頁(yè)面查詢頁(yè)面查詢結(jié)果管理員頁(yè)面 添加圖書頁(yè)面添加圖書信息不完整頁(yè)面三、完整開發(fā)代碼 ( 按照上面截圖部署即可實(shí)現(xiàn) )body background: #ffffff; margin: 15; body,table,th,td,input,select,textarea font-family: Tahoma,Verdana,Aria

3、l,Helvetica,sans-serif; font-size: 12px; border: 1px solid #3366CC; border-collapse: collapse; width: 80%;td padding: 2 5 2 5; height: 26px; text-align: center; border: 1px solid #ffffff; background-color: #f0f0f0;td font-weight: bold; text-align: center; background: #99CCFF; color: red; border: 1px

4、 solid #ffffff; white-space: nowrap; height: 26px; font-weight: bold; color: #333333; text-align: center; vertical-align: top; padding: 10px; font-size: 14px;body font-family: Arial, Helvetica, sans-serif; font-size:12px;color:#666666;background:#fff; text-align:center;* margin:0;padding:0;a color:#

5、1E7ACE;text-decoration:none; a:hover color:#000;text-decoration:underline; h3 font-size:14px;font-weight:bold; pre,p color:#1E7ACE;margin:4px; input, select,textarea padding:1px;margin:2px;font-size:11px;.buttompadding:1px 10px;font-size:12px; border:1px #1E7ACE solid;background:#D0F0FF;#formwrapper

6、 width:450px;margin:15px auto; padding:20px;text-align:left;border:1px solid #A4CDF2; fieldset padding:10px;margin-top:5px;border:1px solid #A4CDF2;background:#fff;fieldset legend color:#1E7ACE;font-weight:bold; padding:3px 20px 3px 20px;border:1px solid #A4CDF2; background:#fff;fieldset label float

7、:left;width:120px; text-align:right;padding:4px;margin:1px; fieldset div clear:left;margin-bottom:2px; .input width:120px;.enter text-align:center;.clear clear:both;function isNum(num)for(i=0;i<i+)c=(i);if(c>'9'|c<'0')return false;return true;function check()alert ("no

8、id!");return false;alert("no name!");return false;alert("no author!");return false;alert("no press!");return false;alert("no date!")return false;if(!isNum) alert("price is wrong!") return false;if(!isNum) alert("account is wring!") ret

9、urn false;package bean;public class bookinfoprivate String id;private String name;private String author;private String press;private String date;private int price;private int account;public void setName(String name) = name;public String getName() return name;public void setAuthor(String author) = au

10、thor;public String getAuthor() return author;public void setDate(String date) = date;public String getDate() return date;public void setPress(String press) = press;public String getPress() return press;public void setId(String id) = id;public String getId() return id;public void setAccount(int acoun

11、t) = acount;public int getAccount() return account;public void setPrice(int price) = price;public int getPrice() return price;public static ArrayList<bookinfo> getbooklist()ArrayList<bookinfo> list=new ArrayList<bookinfo>();String sql="select * from "dbbean jdbc=new dbbea

12、n();ResultSet rs=(sql);trywhile()bookinfo bi=new bookinfo();("id");("name");("author");("press");("date");("price");("account");(bi);();catch(SQLException e)();();return list;Jimport .*;public class dbbeanprivate String name="

13、;root"private String password="xyh201268"private Connection conn=null;private Statement stmt=null;public dbbean()try(driverStr);conn=(connStr,name,password);stmt=();catch(Exception ex)public int executeUpdate(String s)int result=0;tryresult=(s);catch(Exception ex)return result;public

14、ResultSet executeQuery(String s)ResultSet rs=null;tryrs=(s);catch(Exception ex)return rs;public void close()try();();catch(Exception ex)package servlets;import .*;/* Created by Administrator on 14-5-31.*/public class Servlet extends HttpServlet protected void doGet(HttpServletRequest request, HttpSe

15、rvletResponse response) throws ServletException, IOException doPost(request, response);protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException ("utf-8");String action=();if("/servlets/")String value=("password"

16、;);if("123")("list", list);("/").forward(request,response);else("list", list);("/").forward(request,response);else if ("/servlets/")("list", list);("/").forward(request,response);else if ("/servlets/")("li

17、st", list);("/").forward(request,response);else if("/servlets/")String id =("id");("bi",bi);("/").forward(request,response);else if("/servlets/")String id=("id");String name=("name");String author=("author"

18、;);String press=("press");String date=("date");String s_price=("price");String s_account=("account");int price=(s_price);int account=(s_account);if (r=1)("/").forward(request,response);else("/").forward(request,response);else if ("/ser

19、vlets/")String id=("id");if (r=1)("/").forward(request,response); else("/").forward(request,response); else if ("/servlets/")String id=("id");String name=("name");String author=("author");String press=("press");Stri

20、ng date=("date");String s_price=("price");String s_account=("account");int price=(s_price);int account=(s_account);if (r=1)("/").forward(request,response);else("/").forward(request,response);else if ("/servlets/")String buy=("buy"

21、);("bi",bi);("/").forward(request,response);else if ("/servlets/")String id=("id");String name=("name");String author=("author");String user=("user");("list", list);if ("reader")("/").forward(request,

22、response);if ("manager")("/").forward(request,response);else if ("/servlets/")String id=("id");String s_num_buy=("num_buy");int num_buy=(s_num_buy); if()>=num_buy) ("bi",bi); ("s_num_buy",s_num_buy); ("/").forward(req

23、uest,response);else("/").forward(request,response);else if ("/servlets/")String id=("id");String s_num_buy=("s_num_buy");int num_buy=(s_num_buy);("/").forward(request,response);<% page contentType="text/html;charset=UTF-8" language="

24、;java" %><html><head><link rel="stylesheet" href="/bookshop/css/" type="text/css"> <title></title></head><script language="JavaScript" src="/bookshop/js/"></script><body><center><

25、form name="form1" onsubmit="return check()" action="/bookshop/servlets/" method="post"><table class="default" align="center" border="1"><center><h2>圖書信息 v/h2>v/center>vtrxth class="item"> 編號(hào)

26、 </th><tdxinput type="text" name="id">*(不能為空)</td></tr><tr><th class="item"> 書名 </th><td><input type="text" name="name">*( 不能為空 )</td></tr><tr><th class="item"> 作

27、者 </th><td><input type="text" name="author">*(不能為空) </td></tr><tr><th class="item"> 出版社 </th><tdxi nput type="text" name="press">*(不能為空) </td></tr><tr><th class="item&quo

28、t;> 出版日期 v/thxtd><input type="text"name="date">*(不能為空 ) </td></tr><tr><th class="item"> 價(jià)格 </th><td> <in put type="text"n ame="price">*(只能數(shù)字) </td></tr>vtrxth class="item">

29、; 庫(kù)存 </th><td> <in put type="text"n ame="acc oun t">*(只能數(shù)字 ) </td></tr><tr><td colspan="2" align="center"><input type="submit" value=" 添加 "><input type="reset" value="重置"

30、;></td></tr></table></form></center></body></html><% page contentType="text/html;charset=UTF-8" language="java" import="" %> <html><head><link rel="stylesheet" href="/bookshop/css/" ty

31、pe="text/css"> <title></title></head><body><% ("utf-8"); bookinfo bi=(bookinfo)("bi");%><center><form action="/bookshop/servlets/" method="post"><input type="hidden" name="id" value=

32、$><pxh2>訂單信息</h2><table class="default"><tr><th class="item"> 編號(hào) v/th><td>vi nput type="text" value="<%= ()%>" name="name"> </td></tr><tr><th class="item"> 書名 v/th&g

33、t;<td>vinput type="text" value="<%= ()%>" name="name"> </td></tr><tr><th class="item"> 作者 </th><td><i nput type="text" value="<%= ()%>" name="author"> </td></

34、tr><tr><th class="item"> 出版社 </th><td><i nput type="text" value="<%= ()%>" name="press"> </td></tr><tr><th class="item"> 出版日期 v/th><td>vinput type="text" value="&l

35、t;%= ()%>" name="date"> </td></tr><tr><th class="item"> 價(jià)格 </th><td><i nput type="text" value="<%= ()%>" name="price"> </td></tr><tr><th class="item"> 庫(kù)存 <

36、;/th><td><i nput type="text" value="<%= ()%>" name="account"> </td></tr><tr><th class="item"> 購(gòu)買數(shù)量 v/th><td>vinput type="text" name="num_buy"></td></tr><tr><td co

37、lspan="2" align="center"><input type="submit" value=" 提交 "><input type="reset" value="重置"></td></tr></table></form></center></body></html><% page contentType="text/html;charse

38、t=UTF-8" language="java" import="" %><html><head><link rel="stylesheet" href="/bookshop/css/" type="text/css"><title></title></head><body><% ("utf-8");bookinfo bi=(bookinfo)("bi"

39、;);%><center><form action="/bookshop/servlets/" method="post"><input type="hidden" name="id" value=$><h2><caption>修改信息 v/caption>v/h2><table class="default"><tr><th class="item"> 編號(hào) v

40、/th><tdxi nput type="text" value="<%= ()%>" name="id"> v/td>v/tr><tr><th class="item"> 書名 </th><td><input type="text" value=<%= ()%> name="name"> v/td>v/tr><tr><th clas

41、s="item"> 作者 </th><td> <in put type="text" value=<%= ()%> name="author"> v/td>v/tr>vtr>vth class="item"> 出版社 v/th>vtd>vinput type="text" value="v%= ()%>" name="press"> v/td>v/t

42、r>vtr>vth class="item"> 出版日期 v/th>vtd>vinput type="text" value="v%= ()%>" name="date"> v/td>v/tr><tr><th class="item"> 價(jià)格 </th><td><i nput type="text" value="<%= ()%>" na

43、me="price"> v/td>v/tr><tr><th class="item"> 庫(kù)存 </th><td><i nput type="text" value="<%= ()%>" name="account"> v/td>v/tr>vtr>vtd colspan="2" align="center">vinput type="s

44、ubmit" value=" 提交 ">vinput type="reset" value="重置"></td></tr>v/table>v/form>v/center>v/body>v/html>v% page contentType="text/html;charset=UTF-8" language="java" %>vhtml>vhead>vtitle>v/title>v/head&

45、gt;vbody>vcenter><h2>操作失敗</h2>va href="javascript:()"> 點(diǎn)擊返回 v/a></center></body></html><% page contentType="text/html;charset=UTF-8" language="java" %><html><head><title></title></head><bod

46、y><center>vh2>購(gòu)買信息錯(cuò)誤</h2><a href="javascript:()"> 點(diǎn)擊返回 </a></center></body></html><!DOCTYPE html><html><head><meta charset="UTF-8"><link rel="stylesheet" href="/bookshop/css/" type=&quo

47、t;text/css"><title></title></head><body><div id="formwrapper"><h3>圖書商店用戶登錄</h3><form method="post" name="apLogin" id="apLogin" action="/bookshop/servlets/"> <fieldset>vlegend>顧客/管理員登錄v/

48、legend><div>vlabel for="UName"> 用戶名 v/label>vinput type="text" name="UName" class="input" id="UName" size="18" maxlength="30" />*( 顧客不用輸入 )vbr/>v/div>vdiv>vlabel for="PWord"> 密碼 </label&g

49、t;vinput type="password" name="password" class="input" id="PWord" size="18" maxlength="30" />*( 顧客不用輸入 )vbr/>v/div>vdiv class="cookiechk">vlabel for="CookieYN" style="color:#1E7ACE;cursor:pointer;"&

50、gt; 記住我 v/label>vinput type="checkbox" name="CookieYN" id="CookieYN" value="1" /> va href="#" title=" 選擇是否記錄您的信息 ">v/a><input name="login791" type="submit" class="buttom" value="登錄"/>

51、;</div><div class="forgotpass"><a href="#"> 您忘記密碼 ?</a></div></fieldset></form></div><hr align="center" noshade color="#FF0000"><p><center><h3> 友請(qǐng) 連接 </h3><a href="">

52、sina</a><p> Copyright 2014-2015NETWORK.席燚海 鄧勻翔 袁野v/p></center></body></html><html><head><link rel="stylesheet" href="/bookshop/css/" type="text/css"><title></title></head><body><% String user=

53、"manager" %> <center><h2><a href="/bookshop/">添加圖書 </a>v/h2><table class="default" align="center" border="1" ><tr><td colspa n="9" alig n="right"><a href="/bookshop/?user=<

54、;%= user%>"> 點(diǎn)擊查詢 </a></td></tr><tr><th class="item"> 編號(hào) </th><th class="item"> 書名 </th><th class="item"> 作者 v/thxth class="item">出版社</th><th class="item">出版日期 </th>

55、;<th class="item">價(jià)格 </th><th class="item"> 庫(kù)存 </th><th class="item" colspa n="2"> 管理 v/th></tr><%("utf-8");ArrayList<bookinfo> list=(ArrayList<bookinfo>)("list");for(bookinfo bi:list)St

56、ring id=();%><tr><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><a href="/b

57、ookshop/servlets/?id=<%= id%>">修改 </a></td><td><a href="/bookshop/servlets/?id=<%= id%>"> 刪除 </a></td></tr><%></table><p></p><a align="right" href="/bookshop/"> 返回主頁(yè) </a>&l

58、t;/center></body></html><%-Created by IntelliJ IDEA.User: AdministratorDate: 14-12-28Time: 下午 8:49To change this template use File | Settings | File Templates.-%><% page contentType="text/html;charset=UTF-8" language="java" %><html><head><

59、;title></title></head><body><center><h2>正在打印訂單,請(qǐng)稍候</h2>vp><a href='7bookshop/servlets/">£ 回主頁(yè) </a></center></body></html><html><head><link rel="stylesheet" href="/bookshop/css/" t

60、ype="text/css"><title></title></head><body><% String user="reader"%><center><form action="/bookshop/servlets/" method="post"><table class="default" align="center" border="1" ><

61、tr class="title"><h2> 現(xiàn)有圖書信息 </h2></tr><p></p><tr><td colspan="8" align="right"><a href="/bookshop/?user=<%= user%>"> 點(diǎn)擊查詢 v/a>v/td>v/tr><tr><th class="item"> 編號(hào) </th>

62、;<th class="item"> 書名 </th><th class="item"> 作者 v/thxth class="item"> 出版社 </th><th class="item"> 出版日期v/thxth class="item"> 價(jià)格 </th><th class="item"> 庫(kù)存 </th><th class="item"

63、> 購(gòu)買 </th></tr><%("utf-8");ArrayList<bookinfo> list=(ArrayList<bookinfo>)("list");for(bookinfo bi:list)String id=();%><tr><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><

64、%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><%= ()%></td><td><input type="radio" name="buy" value="<%= ()%>"></td><input type="hidden" name="id" value=&qu

65、ot;<%= ()%>"></tr><%></table><p><input type="submit" value=" 提交"></form><a align="right" href="/bookshop/"> 返回主頁(yè) </a></center></body></html><html><head><link rel=&qu

66、ot;stylesheet" href="/bookshop/css/" type="text/css"><title></title></head><body><center><caption><h2>Results Of Search</h2></caption><p><table class="default" align="center" border="1

67、" ><tr><th class="item">Num</th><th class="item">Name</th><th class="item">Author</th><th class="item">Press</th><th class="item">Press_Date</th><th class="item"&g

68、t;Price</th><th class="item">Account</th><th class="item" colspan="2">Manage</th></tr><%(=u?8)AITayLisAbookinfov -isll(AITayLisAbookinfov)(-三S3八fo(bookinfo br-iso宀Siring idHO八%vAvdx%H ()xndxfdx%H ()xndxfdx%H ()xndxQ:x%H ()xndxfdx%H

69、 ()xndvdx%H ()xndvdx%H ()xndvdxa helr-7bookshop、serv-efsr?idHA%H id%vvEdiA、axndv dxa helr-7bookshop、serv-efsr?idHA%H id%vvDe-e(D4axndv %vAQrb-evAcenfervAbodyv4hfm-vAhfm-VAheadvink rell=sfy-esheev hrelrvbookshopo-ssr fypeH=(Dxucss=vmexnmevAheadvAbodyvAcenfervform acfionH-7bookshop、serv-efsr mefhodH=p

70、osrvAcapfionxh2v14s>>AhzvAcapfionxpv ab-e c-assH=defau-v a=gnH=cen(D= borden-iVAvh c-assH二(Dm=v>4n4fhxfh c-assH二(Dm-v岀aAfhxfh c-assH二(Dm-vAfhxfh c-assH二(Dm-v圧a#Afhxfh c-assH二(Dm-v圧SBSAfhvh c-assH二(Dm-vAfhxfh c-assH二(Dm-vwAfhxfh c-assH二(Drrr co-spanH=2=vsyNAfhv(=u?8)AITayLisAbookinfov =sll(A

71、ITayLisAbookinfov)(=s3八fo(bookinfo br=so宀Siring idHO八%vAvdx%H ()xndxfdx%H ()xndxfdx%H ()x>dxfdx%H()xndxfdx%H ()xndv<td><%= ()%></td><td><%= ()%></td><td><input type="radio" name="buy" value="<%= ()%>"></td>

72、<input type="hidden" name="id" value="<%= ()%>"></tr><%></table><p><input type="submit" value=" 提交 "></form></center></body></html><% page contentType="text/html;charset=UTF-8&

73、quot; language="java" %><html><head><link rel="stylesheet" href="/bookshop/css/" type="text/css"><title></title></head><body><% ("utf-8");String user=(String)("user");%><center><form action="/bookshop/servlets/" method="post"><p>vcaption><h2>圖書信息查詢 </h2>v/caption>vp>編號(hào)查詢: <input type="text" name="id">*( 若輸入則需完整 )<p> 書名查詢: <input type="text" name="nam

溫馨提示

  • 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ù)覽,若沒有圖紙預(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)論