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

正文內(nèi)容

基于ejb30的分布式網(wǎng)上購(gòu)物系統(tǒng)-資料下載頁(yè)

2024-08-14 22:53本頁(yè)面
  

【正文】 書簡(jiǎn)介基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 294. 訂單信息表:tbl_order屬性名 類型 描述order_id integer 訂單標(biāo)識(shí)號(hào),自動(dòng)遞增的主鍵user_id integer 用戶標(biāo)識(shí)號(hào)order_total_price decimal(7,2) 訂單總價(jià)order_create_time timestamp 下單日期和時(shí)間5. 訂單明細(xì)信息表:tbl_item屬性名 類型 描述item_id integer 訂單明細(xì)標(biāo)識(shí)號(hào),自動(dòng)遞增的主鍵order_id integer 訂單標(biāo)識(shí)號(hào)book_id integer 圖書標(biāo)識(shí)號(hào)item_quantity integer 訂單中每種圖書購(gòu)買數(shù)量基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 305 系統(tǒng)實(shí)現(xiàn)與測(cè)試 功能實(shí)現(xiàn) 搜索功能的實(shí)現(xiàn)實(shí)現(xiàn)搜索功能的是BookFacade類中的findByTitleKeywordAndClassify方法,其代碼如下:public ListBook findByTitleKeywordAndClassify(final Object keyword, String classify, final int... rowStartIdxAndCount) {try {final String queryString = select model from Book model where = :classifyValue and like :keywordValue。Query query = (queryString)。(classifyValue, classify)。(keywordValue, % + keyword + %)。if (rowStartIdxAndCount != null amp。amp。 0) {int rowStartIdx = (0, rowStartIdxAndCount[0])。if (rowStartIdx 0) {(rowStartIdx)。}if ( 1) {int rowCount = (0, rowStartIdxAndCount[1])。if (rowCount 0) {(rowCount)。}}}return ()。} catch (RuntimeException re) {throw re。}}findByTitleKeywordAndClassify 方法使用 JPQL 語(yǔ)句在數(shù)據(jù)庫(kù)中進(jìn)行查詢,它同時(shí)實(shí)現(xiàn)了結(jié)果集的分頁(yè)功能,由參數(shù) rowStartIdxAndCount 設(shè)置要返回記錄的起始下標(biāo)和條數(shù)。div class=search 選擇分類 form name=search method=post action=servlet/BookQueryServlet基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 31 select name=classify option selected=selected value=all全部分類/ option option value=technology科技/option option value=manage管理/option option value=literature文學(xué)/option option value=life生活/option option value=study教材教輔考試/ option /select input type=text name=keyword size=100/ input type=submit name=submit value=搜索 / /form/div如上是 頁(yè)面中實(shí)現(xiàn)搜索功能的代碼,用戶點(diǎn)擊“搜索”按鈕之后,請(qǐng)求發(fā)送到 BookQueryServlet,它調(diào)用 BookFacade 類中的 findByTitleKeywordAndClassify方法,然后把查詢的結(jié)果集返回給 頁(yè)面顯示,具體代碼如下:protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String path = ()。String basePath = () + :// + () + : + () + path + /。String classify = (String)(classify)。String keyword = (String)(keyword)。String pageindex = (String)(pageindex)。if(!(pageindex)) pageindex = 1。int pageIndex = (pageindex)。BookFacadeRemote bookDAO = (BookFacadeRemote)()。int[] rowStartIdxAndCount = (PAGINATION_COUNT, pageIndex)。ListBook bookList = null。if((all)) {bookList = (keyword, rowStartIdxAndCount)。} else {bookList = (keyword, classify, rowStartIdxAndCount)。}HttpSession session = ()。(pageindex, pageindex)。(booklist, bookList)。(basePath + jsp/)。} 頁(yè)面中顯示結(jié)果的代碼如下:基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 32% String pageindex = (String)(pageindex)。 if((pageindex)) int pageIndex = (pageindex)。 ListBook bookList = (ListBook)(booklist)。 for(Book book : bookList) {%div class=search_book a href=servlet/BookDetailServlet?bookid=%=()%img class=book src=%=()% id=%=()% alt=書籍預(yù)覽圖片 //abr/div class=book_infoa class=search_book_name href=servlet/BookDetailServlet?bookid=%=()%%=()%/abr/ %=()%br/ %=()%br/ label class=book_price¥%=()% /label /div/div%}%圖 51 為主頁(yè) ,分頁(yè)顯示所有圖書,可以通過(guò)點(diǎn)擊網(wǎng)站圖標(biāo)回到主頁(yè)。圖 52 為顯示搜索結(jié)果的 頁(yè)面,依次列出各項(xiàng)?;? 的分布式網(wǎng)上購(gòu)物系統(tǒng) 33圖 51 在主頁(yè)上進(jìn)行搜索圖 52 顯示搜索結(jié)果 購(gòu)物車功能的實(shí)現(xiàn)div class=shop_cart form name=book_detail method=post action=servlet/AddItemServlet 數(shù)量:基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 34select name=quantity option value=1 selected=selected1/option option value=22/option /selectbr/ input type=submit name=submit value=加入購(gòu)物車 / /form/div,用戶點(diǎn)擊“加入購(gòu)物車”按鈕后,請(qǐng)求發(fā)送到AddItemServlet,它將指定數(shù)量的某一圖書加入到用戶的購(gòu)物車中。如果用戶沒(méi)有購(gòu)物車,它將會(huì)給用戶新建一個(gè)購(gòu)物車;如果購(gòu)物車中已經(jīng)有了這本書,它將更新數(shù)量。具體代碼如下:protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String path = ()。String basePath = () + :// + () + : + () + path + /。HttpSession session = ()。String quantity = (String)(quantity).trim()。if((quantity))int itemQuantity = (quantity)。Book book = (Book)(book)。Order order = (Order)(order)。if(order == null) {order = new Order()。(0d)。}SetItem itemSet = ()。boolean itemNotExist = true。for(Item item : itemSet)if(().getBookTitle().equals(())) {(() + itemQuantity)。itemNotExist = false。break。}if(itemNotExist) {Item newItem = new Item()。(order)。(book)。(itemQuantity)。(newItem)。}double totalPrice = () * itemQuantity + ()。(totalPrice)?;? 的分布式網(wǎng)上購(gòu)物系統(tǒng) 35(order, order)。(basePath + jsp/)。}圖 53 為圖書詳細(xì)信息的顯示頁(yè)面 的截圖,點(diǎn)擊右邊的“加入購(gòu)物車”按鈕,則會(huì)重定向到如圖 54 所示的顯示當(dāng)前購(gòu)物車信息的 頁(yè)面。圖 53 顯示圖書詳細(xì)信息圖 54 顯示購(gòu)物車信息基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 36 發(fā)送郵件功能的實(shí)現(xiàn)實(shí)現(xiàn)發(fā)送郵件功能的是 MailService 類,它是使用 JavaMail 的一個(gè)輔助類。其主要方法 sendout 代碼如下:public boolean sendout() { try { (mp)。 ()。 Session mailSession = (props, null)。 Transport transport = (smtp)。 ((String)(), username, password)。 (mimeMsg, ())。 ()。 return true。 } catch (Exception e) { ()。return false。 }}在用戶下單之后,由 ProcessOrderServlet 處理用戶請(qǐng)求。它向 MailQueue 消息隊(duì)列發(fā)送消息,MailServiceBean 監(jiān)聽(tīng)到之后調(diào)用 onMessage 方法發(fā)送郵件。向 MailQueue發(fā)送消息的代碼如下:try{Context ctx = new InitialContext()。QueueConnectionFactory factory = (QueueConnectionFactory)(ConnectionFactory)。try {QueueConnection connection = ()。QueueSession queueSession = (false, )。Queue queue = (Queue) (queue/MailQueue)。QueueSender publisher = (queue)。MapMessage msg = ()。(to, ())。(content, content)。(msg)。()。} catch (JMSException e) {()。}基于 的分布式網(wǎng)上購(gòu)物系統(tǒng) 37()。}catch (NamingException e) {()。}MailServiceBean 是一個(gè)監(jiān)聽(tīng) MailQueue 消息隊(duì)列的 MDB。它在 onMessage 方法中調(diào)用 MailService 類中的 sendout 方法,當(dāng)有消息到達(dá)時(shí),onMessage 方法自動(dòng)執(zhí)行。@MessageDriven(mappedName = jms/MailServiceBean, activationConfig = {@ActivationConfigProperty(propertyName = acknowledgeMode, propertyValue = Autoacknowledge),@ActivationConfigProperty(propertyName = destinationType, propertyValue = ),@ActivationConfigPr
點(diǎn)擊復(fù)制文檔內(nèi)容
電大資料相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1