【正文】
I 基于 J2EE 技術(shù)的團(tuán)購網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn) 摘 要 本文先介紹了目前國內(nèi)基于 WEB 的團(tuán)購網(wǎng)站的研究、應(yīng)用和發(fā)展現(xiàn)狀 , 然后系統(tǒng)地介紹了本團(tuán)購系統(tǒng)所應(yīng)用的相關(guān)技術(shù),主要包括 MVC 設(shè)計(jì)模式, J2EE 技術(shù)的三大輕量級框架 Sturts Hibernate 以及 Spring,另外還有用于實(shí)現(xiàn)異步交互以增強(qiáng)用戶體驗(yàn)的 Ajax 技術(shù)。 本文 結(jié)合自己的開發(fā)使用經(jīng)驗(yàn),詳細(xì)地分析了以上技術(shù)的工作原理、性能分析、應(yīng)用場景及未來的應(yīng)用前景。在以上的技術(shù)理論基礎(chǔ)上,再結(jié)合實(shí)際團(tuán)購環(huán)境中,通過團(tuán)購網(wǎng)站的特點(diǎn),提出問題,分析問題;然后對整個(gè)團(tuán)購 系統(tǒng)進(jìn)行需求分析,明晰了商家與用戶的整體需求;之后便對整個(gè) WEB 系統(tǒng)進(jìn)行了架構(gòu)設(shè)計(jì),針對 WEB 功能表現(xiàn)層、業(yè)務(wù)邏輯層、數(shù)據(jù)持久層結(jié)合 MVC 的設(shè)計(jì)模式進(jìn)行了細(xì)化分析設(shè)計(jì),并設(shè)計(jì)實(shí)現(xiàn)了相應(yīng)的數(shù)據(jù)庫表結(jié)構(gòu)。最后將 Ajax 等 技術(shù)整合到 J2EE 平臺中,實(shí)現(xiàn)了一套安全、穩(wěn)定、可靠并具有良好地用戶體驗(yàn)的在線團(tuán)購網(wǎng)站系統(tǒng)。從某種程度上來說,這也彌補(bǔ)了目前國內(nèi)的團(tuán)購系統(tǒng)都是基于 PHP 實(shí)現(xiàn)的一個(gè)空白。 關(guān)鍵詞: 團(tuán)購網(wǎng)站 ; J2EE; SSH 框架; MVC 設(shè)計(jì)模式 ; Ajax II Design and Implementation of J2EE technologybased Group purchase web sites ABSTRACT This article first introduced under the current WEBbased domestic Group purchase web sites research, application and development status. And then systematically introduced the related technologies for applications in this buy, including the MVC design pattern, the three lightweight framework Sturts2 that J2EE technology, the Hibernate and Spring, in addition to, Ajax technology that can realize asynchronous interaction to enhance the experience of users. Combined with my development experience, detailed analysis of the above technique works, performance analysis, scenarios and future applications. Based on the theory, bined with the environment of the actual group purchase sites features, asked questions, analyzed problems。 and then made needs analysis of the whole purchase system, clarity of the overall needs of businesses and users。 and then the WEB system architecture design functionality for WEB presentation layer, business logic layer, data persistence layer bined with the MVC design pattern for a detailed analysis of design and realized the corresponding database table structure. Finally,the Ajax and other Web technology integrated into the J2EE platform to achieve a safe, stable, and reliable and has a good user experience to the online shopping sites some extent, this can also make up for a blank of the domestic buy systems based on PHP. Key words: Group purchase web sites。 J2EE。 SSH framework。 MVC design pattern。 the Ajax III 目 錄 1 緒論 ........................................... 1 課題研究背景及意義 ............................. 1 課題研究背景 ............................... 1 課題理 論指導(dǎo)及現(xiàn)實(shí)研究意義 .................. 1 J2EE 平臺 .................................. 2 J2EE 框架 .................................. 3 MVC 設(shè)計(jì)模式 ................................ 3 AJAX 技術(shù) .................................. 4 本論文的內(nèi)容及組織結(jié)構(gòu) ......................... 4 2 相關(guān)技術(shù)詳解及應(yīng)用心得 ......................... 6 J2EE 框架之 Struts 篇 ........................... 6 Struts 概述 ............................. 6 Struts 與 比較 .................. 6 Struts 體系結(jié)構(gòu) ......................... 7 Struts 的性能及應(yīng)用前景分析 .............. 9 J2EE 框架之 Hibernate 篇 ........................ 9 Hibernate 概述 .............................. 9 Hibernate 的 ORM 技術(shù)介紹 ................... 10 Hibernate 的體系結(jié)構(gòu) ....................... 11 Hibernate 的性能及應(yīng)用前景分析 ............. 12 IV J2EE 框架之 Spring 篇 .......................... 12 Spring 體系結(jié)構(gòu)概述 ........................ 12 Spring 的核心工作機(jī)制 ...................... 14 AJAX 框架篇 ................................... 15 AJAX 技術(shù)體系概述 .......................... 15 AJAX 技術(shù)及工 作原理分析 .................... 16 AJAX 優(yōu)缺點(diǎn)及應(yīng)用前景分析 .................. 17 3 團(tuán)購網(wǎng)站系統(tǒng)分析 .............................. 18 系統(tǒng)可行性研究 ................................ 18 問題的提出 ................................ 18 分析問題 .................................. 18 系統(tǒng)設(shè)計(jì)思想 .............................. 19 系統(tǒng)需求分析 .................................. 19 用戶需求分析 .............................. 19 系統(tǒng)功能需求 .............................. 19 系統(tǒng)功能分析 .............................. 20 系統(tǒng)開發(fā)平臺的選擇 ............................ 21 4 WEB系統(tǒng)架構(gòu)分析 ............................... 22 系統(tǒng)應(yīng)用模型的技術(shù)分析 ........................ 22 客戶端與服務(wù)器 (C/S)及瀏覽器與服務(wù)器 (B/S) .... 22 當(dāng)今主流開發(fā)模式及未來趨勢分析 ............. 23 系統(tǒng)架構(gòu)設(shè)計(jì)的目標(biāo) ............................ 23 V 系統(tǒng)架構(gòu)的總體分析與實(shí)現(xiàn) ...................... 24 架構(gòu)分析 .................................. 24 架構(gòu)實(shí)現(xiàn) .................................. 24 5 系統(tǒng)數(shù)據(jù)庫設(shè)計(jì) ................................ 27 數(shù)據(jù)庫 ER 圖設(shè)計(jì) .............................. 27 數(shù)據(jù)庫表的設(shè)計(jì)實(shí)現(xiàn) ............................ 28 6 團(tuán)購系統(tǒng)的具體實(shí)現(xiàn) ............................. 33 數(shù)據(jù)持久化對象 ................................ 33 數(shù)據(jù)持久層代碼實(shí)現(xiàn) ............................ 36 DAO 層接口類 ............................... 36 DAO 層接口實(shí)現(xiàn)類 ........................... 37 業(yè)務(wù)邏輯層代碼實(shí)現(xiàn) ............................ 39 業(yè)務(wù)邏輯層接口類 .......................... 39 業(yè)務(wù)邏輯層接口實(shí)現(xiàn)類 ....................... 40 表現(xiàn)層代碼實(shí)現(xiàn) ................................ 41 Action 類實(shí)例 .............................. 42 Ajax 動態(tài)驗(yàn)證登錄、注冊 .................... 43 商家地圖信息顯示 .......................... 45 在線支付 —— 三層架構(gòu)的集 成實(shí)例 ................ 46 頁面提交部分代碼 .......................... 47 Action 處理客戶端頁面請求 .................. 47 頁面向發(fā)送 YeePay 接口發(fā)送數(shù)據(jù) .............. 49 VI WEB 系統(tǒng)輔助工具代碼實(shí)現(xiàn) ...................... 49 頁面驗(yàn)證碼 ................................ 49 中文亂碼的解決 ............................ 51 JUnit 單元測試 ................................ 51 部分頁面功能顯示 .............................. 53 結(jié) 論 .......................................... 58 參考文獻(xiàn) ........................................ 60 致 謝 .......................................... 61 1 1 緒論 課題研究背景及意義 課題研究背 景 用低廉的價(jià)格吸引用戶,用成規(guī)模的用戶群吸引商家,用來自商家的傭金實(shí)現(xiàn)迅速盈利 —— 眼下,這種商業(yè)模式獨(dú)特的團(tuán)購網(wǎng)站,正在全球掀起一股團(tuán)購熱潮。因美國團(tuán)購網(wǎng)站 Groupon