戶外用品銷售網(wǎng)站源程序代碼_第1頁
戶外用品銷售網(wǎng)站源程序代碼_第2頁
戶外用品銷售網(wǎng)站源程序代碼_第3頁
戶外用品銷售網(wǎng)站源程序代碼_第4頁
戶外用品銷售網(wǎng)站源程序代碼_第5頁
已閱讀5頁,還剩155頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、戶外用品銷售網(wǎng)站源程序代碼1、網(wǎng)站首頁index.jsp代碼清單4.2.1戶外用品銷售網(wǎng)站 a href= align=left隱藏 / a href=顯示 登陸 | 新用戶注冊 | 管理員入口   % if(index+1 a href=# onclick=window.open(,s,width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes);img src= width=135 height=200 border=0 商品名: 類別: 單價:¥ a href=# onclick=window.open(,

2、s,width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes);       % if(index+2 a href=# onclick=window.open(,s,width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes);img src= width=135 height=200 border=0 商品名: 類別: 單價:¥ a href=# onclick=window.open(,s,width=300,height

3、=300,scrollbars=yes,resizeable=yes,ststus=yes);           % if(index+3 a href=# onclick=window.open(,s,width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes);img src= width=135 height=200 border=0 商品名: 類別: 單價:¥ a href=# onclick=window.open(,s,width=300,height=300

4、,scrollbars=yes,resizeable=yes,ststus=yes);       % if(index+4 a href=# onclick=window.open(,s,width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes);img src= width=135 height=200 border=0 商品名: 類別: 單價:¥ a href=# onclick=window.open(,s,width=300,height=300,scrollbars=yes,re

5、sizeable=yes,ststus=yes);           % if(index+5 a href=# onclick=window.open(,s,width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes);img src= width=135 height=200 border=0 商品名: 類別: 單價:¥ a href=# onclick=window.open(,s,width=300,height=300,scrollbars=yes,resize

6、able=yes,ststus=yes);       % if(index+6 a href=# onclick=window.open(,s,width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes);img src= width=135 height=200 border=0 商品名: 類別: 單價:¥ a href=# onclick=window.open(,s,width=300,height=300,scrollbars=yes,resizeable=yes,ststus=ye

7、s);       % string aft=/outdoorshop/index.jsp?pg=+integer.tostring(index/6+2);string pre=/outdoorshop/index.jsp?pg=+integer.tostring(index/6);if(pg.equals(1) if(integer.parseint(pg) 上一頁   共/頁   a href=下一頁 上一頁   共/頁   下一頁 % el

8、se if(integer.parseint(pg) a href=上一頁   共/頁   a href=下一頁 a href=上一頁   共/頁   下一頁 2、showoutdoor.java的代碼清單4.2.2/* * 該servlet接受來自index.jsp中戶外用品導(dǎo)航鏈接及站內(nèi)搜索的請求, * 用于判斷需顯示戶外用品并從數(shù)據(jù)庫中讀出對應(yīng)戶外用品信息, * 最后將控制權(quán)交給index.jsp */import java.io.*;import java.sql.*

9、;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import bean.outdoorinf;import bean.dbclass;import bean.strclass;public class showoutdoor extends httpservletpublic void doget(httpservletrequest request, httpservletresponse response)throws servletexception, ioexceptionrequest.se

10、tcharacterencoding(gb2312);string key=request.getparameter(key); /key變量用于儲存用戶搜索信息string message=;vector outdoorlist=new vector(); /outdoorlist變量用于顯示待顯示圖書的信息httpsession session=request.getsession();string query=select * from outdoor where ; /query變量用于儲存sql語句/* 移除session中已有outdoorlist變量 */if(session.g

11、etattribute(boolist)!=null)session.removeattribute(boolist);/* 判斷哪些圖書需要被顯示 */if(key=null) /用戶沒有進行站內(nèi)搜索if(request.getparameter(type)=null) query+=ifnew=yes; else string type=;if(request.getparameter(type).equals(dsx)type=登山鞋;if(request.getparameter(type).equals(tbx)type=徒步鞋;if(request.getparameter(typ

12、e).equals(sxx)type=溯溪鞋;if(request.getparameter(type).equals(stx)type=沙灘鞋;if(request.getparameter(type).equals(gsx)type=高山鞋;if(request.getparameter(type).equals(dgnx)type=多功能鞋;if(request.getparameter(type).equals(xxhwx)type=休閑戶外鞋;if(request.getparameter(type).equals(xxbb)type=小型背包;if(request.getparam

13、eter(type).equals(zxbb)type=中型背包;if(request.getparameter(type).equals(dxbb)type=大型背包;if(request.getparameter(type).equals(fyz)type=背包防雨罩;if(request.getparameter(type).equals(ybgb)type=腰包/掛包;if(request.getparameter(type).equals(shd)type=水袋;if(request.getparameter(type).equals(cfy)type=沖鋒衣;if(request.

14、getparameter(type).equals(zry)type=抓絨衣;if(request.getparameter(type).equals(hwny)type=戶外內(nèi)衣;if(request.getparameter(type).equals(hwkz)type=戶外褲裝;if(request.getparameter(type).equals(hwts)type=戶外t恤;if(request.getparameter(type).equals(hwcs)type=戶外襯衫;if(request.getparameter(type).equals(hwwz)type=戶外襪子;i

15、f(request.getparameter(type).equals(zp)type=帳篷;if(request.getparameter(type).equals(sd)type=睡袋;if(request.getparameter(type).equals(fcd)type=防潮墊;if(request.getparameter(type).equals(xsb)type=洗漱包;if(request.getparameter(type).equals(kjkl)type=烤架/烤爐;if(request.getparameter(type).equals(tgcj)type=套鍋餐具;

16、if(request.getparameter(type).equals(qlyl)type=氣爐油爐;if(request.getparameter(type).equals(ydd)type=營地?zé)?頭燈;if(request.getparameter(type).equals(sdt)type=手電筒;if(request.getparameter(type).equals(znz)type=指南針;if(request.getparameter(type).equals(dsz)type=登山杖;if(request.getparameter(type).equals(hwyj)typ

17、e=戶外眼鏡;query+=type=+ type + ; else /請求來自用戶搜索query+=name like + %+ key+ % + or author like + %+ key + % + or publisher like + %+ key+ %; /* 數(shù)據(jù)庫操作 */dbclass db=new dbclass(); db.connect(); resultset resultset=db.executequery(query);trywhile(resultset.next()outdoorinf outdoor=new outdoorinf(resultset.g

18、etstring(id), resultset.getstring(name), resultset.getstring(price), resultset.getstring(type);outdoorlist.addelement(outdoor);catch(sqlexception sqle)message=executeupdate:+sqle;db.closeconnection();/* 將outdoorlist寫入session并轉(zhuǎn)到index.jsp */session.setattribute(outdoorlist, outdoorlist);response.sendr

19、edirect(/outdoorshop/index.jsp);public void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception doget(request, response);3、outdoorinf.java的代碼清單4.2.3/* * 這是一個用于儲存戶外用品信息的bean */package bean;import java.util.*;public class outdoorinfprivate string id; /

20、商品號private string name; /商品名private string price;/單價private string type; /類型public outdoorinf()id=;name=;price=;type=;public outdoorinf(string id,string name,string price,string type)this.id=id;=name;this.price=price;this.type=type; public string getid() return id; public void setid(string

21、id) this.id=id; public string getname() return name; public void setname(string name) =name; public string getprice() return price; public void setprice(string price) this.price=price; public string gettype() return type; public void settype(string type) this.type=type;4、menuhidden.java的代碼清

22、單4.2.4/* * 該servlet用于隱藏用戶菜單 */import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class menuhidden extends httpservletpublic void doget(httpservletrequest request, httpservletresponse response)throws servletexception, ioexceptionhttpsession session=request.getsession();/* 如果se

23、ssion中沒有hidden變量,則設(shè)置一個;否則保持原狀 */if(session.getattribute(hidden)=null)session.setattribute(hidden,hidden);/* 返回發(fā)出請求的頁面 */string tojsp=request.getparameter(jspurl)+?+request.getparameter(param);response.sendredirect(tojsp);5、menushow.java的代碼清單4.2.5/* * 該servlet用于顯示用戶菜單 */import java.io.*;import javax.

24、servlet.*;import javax.servlet.http.*;public class menushow extends httpservletpublic void doget(httpservletrequest request, httpservletresponse response)throws servletexception, ioexceptionhttpsession session=request.getsession();/* 如果session中有hidden變量,則移除;否則保持原狀 */if(session.getattribute(hidden)!=

25、null)session.removeattribute(hidden);/* 返回發(fā)出請求的頁面 */string tojsp=request.getparameter(jspurl)+?+request.getparameter(param);response.sendredirect(tojsp);6、樣式表css文件清單4.2.6/*/* emx_nav_left.css */* use with template halo_leftnav.html */*/*/* html tag styles */*/bodyfont-family: arial,sans-serif;color: #333333;line-height: 1.166;margin: 0px;padding: 0px;background: #cccccc url(bg_grad.jpg) fixed;/* hyperlink and anchor tag styles */a:link, a:visitedcolor: #005fa9;text-decoration: no

溫馨提示

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

評論

0/150

提交評論