freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

基于jsp的網上購書系統(tǒng)畢業(yè)論文(已改無錯字)

2022-07-24 22:08:53 本頁面
  

【正文】 ion, IOException { //把頁面取得在內容轉換成Utf8類型 (UTF8)。 //從頁面取字段值 String name=(rycx)。 (name+這是Servlet取值)。 //double price=new Long((price))。 MapLong, Book book。 try { book=(name)。 //與orderinfo頁面的${}對應 (books, book)。 //將內容填充到網頁中并顯示! ().forward(request,response)。 } catch (OrderServiceException e) { ()。 } } }然后,servlet層條用service層的IOrderService方法:public interface IOrderService { //保存訂單 void saveOrder(Orderform order) throws OrderServiceException。 //刪除訂單 void delOrder(Long orderid) throws OrderServiceException。 //查找用戶所有訂單 MapLong,Orderform listAllOrder(Long customerid) throws OrderServiceException。 //查找單個訂單 Orderform findOrderById(Long orderid) throws OrderServiceException。 //查找所有書籍 MapLong,Book listAllBook() throws OrderServiceException。 //查找書籍 MapLong,Book listBook(String name) throws OrderServiceException。 //增加書籍 void add_Book(String name,Double price) throws OrderServiceException。}最后,通過調用dao層的findbook方法,與數據庫進行交互:public MapLong,Book findBook(String name) throws Exception { (***調用函數了***)。 StringBuffer buffer=new StringBuffer()。 (from Book where 1=1)。 if(name!=) ( and name like 39。%+name+%39。)。 //sql語句放到buffer中 //if(price!=) // ( or price = 39。+price+39。)。 (())。 //if(!unlimited.equals(provincecity)) // (=+provincecity+)。 String hql=()。 //轉換為string類型 Session session=()。 //Query query=(from Book where name like 39。%+name+%39。 or price like 39。%+price+%39。)。 Query query=(hql)。 //執(zhí)行hql語句(sql) List list=()。 MapLong,Book books=new TreeMapLong,Book()。 if(list!=null) { for(Object o:list) //遍歷集合(數組)目的:把sql語句執(zhí)行結果存入集合(數組) { Book book=(Book)o。 ((),book)。 } } return books。 } 購物車部分當點擊“查看購物車”時,就調用ClearCartServlet中的doGet和doPost方法,通過service調用相應dao層的方法,這個Action將已購買的書名信息和數量信息導入購物車,此時頁面就跳轉到“購物車列表”頁面上了,用戶可以看到剛剛購買過的圖書的書名、數量、總價等信息出現在購物車列表里。此時用戶可以對購物車進行修改操作,用戶可以進行數量的更改、刪除所購圖書、返回圖書列表繼續(xù)購買和提交訂單等操作。購物車界面如圖422所示:圖43 購物車列表界面其部分實現代碼如下:public class ShoppingCart {private MapLong,Orderline cart = new TreeMapLong,Orderline()。//增加Orderlinepublic void addLine1(Orderline line) { Orderline orderline = (().getId())。 if(orderline != null) (())。 else if(()0) (().getId(), line)。} //刪除Orderlinepublic void dropLine(Long lineid) { (lineid)。 } //獲得單個Orderlinepublic Orderline getOrderline(Long lineid){return (lineid)。} //獲得所有Orderlinepublic CollectionOrderline getOrderlines() {return ()。}//獲得購物車總價public double getCost() {double cost = 。CollectionOrderline c = getOrderlines()。for(Orderline orderline : c){ cost += ().getPrice() * ()。}return cost。}//清空購物車public void removeAll() {()。}//判斷購物車是否為空public boolean isEmpty(){ 用戶信息部分和購物清單部分當點擊“提交訂單”時,請求就進入ListOrderServlet中,調用其中的doPost方法,執(zhí)行這個Action中的操作,執(zhí)行完之后就進行內部跳轉和外部重定向,跳轉到根目錄的確認訂單頁面中,該頁面從數據庫中取到了用戶的姓名、送貨地址、Email等注冊信息和用戶所購圖書的信息。其用戶信息中的郵編、地址、電話、電子信箱字段是可以修改的,姓名字段不可修改,因為其被設置為只讀屬性。其實現效果圖如圖423所示:圖423 購物清單界面部分實現代碼如下:public class ConfirmServlet extends HttpServlet { private IOrderService orderService。 private ICustomerService customerService。 public void init() {orderService=(IOrderService)()。 customerService=(ICustomerService)()。 } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doPost(request,response)。 }@SuppressWarnings({ unchecked, unchecked }) public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // //并將新的用戶的信息替換customer原有作息 HttpSession session=()。 Customer customer=(Customer)(customer)。 Customer c=new Customer()。 (())。 (())。 (())。 (())。 (())。 (())。 (())。 (())。 ShoppingCart cart=(ShoppingCart) (cart)。 Orderform order=new Orderform()。 //指定定單的擁有人 (customer)。 (new Date())。 (())。 CollectionOrderline lines=()。 for(Orderline line:lines) { //建立orderform與orderline的雙向關系 ().add(line)。 (order)。 } try { (c)。 } catch (CustomerServiceException e) { ()。 } try { //因為有級聯關系所以保存order就保存了和它級聯的對象 (order)。 ()。 } catch (OrderServiceException e) { ()。 ()。}}} 用戶訂單管理模塊的設計 訂單列表部分當用戶在圖書列表界面上點擊“查看用戶訂單”時,請求就進入ListOrderServlet中,此Action將請求轉發(fā)到:8888/estore_jsp/,該頁面包含訂單號、下單時間、訂單金額和操作信息,用戶和管理員可以根據需要刪除已下訂單。其實現效果圖如圖431所示:圖431 購物訂單列表界面其中部分實現代碼如下:public class ListO
點擊復制文檔內容
醫(yī)療健康相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1