基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)_第1頁(yè)
基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)_第2頁(yè)
基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)_第3頁(yè)
基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)_第4頁(yè)
基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)_第5頁(yè)
已閱讀5頁(yè),還剩59頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

天津工業(yè)大學(xué)畢業(yè)設(shè)計(jì)(論文)基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)姓名學(xué)院計(jì)算機(jī)科學(xué)與軟件專業(yè)軟件工程指導(dǎo)教師職稱2015年6月1日天津工業(yè)大學(xué)畢業(yè)設(shè)計(jì)(論文)任務(wù)書題目基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)學(xué)生姓名謝辰學(xué)院名稱計(jì)算機(jī)科學(xué)與軟件專業(yè)班級(jí)軟件1105課題類型實(shí)際課題課題意義隨著互聯(lián)網(wǎng)快速、廣泛的普及應(yīng)用,電子郵件越來(lái)越受到人們的歡迎,其最大的特點(diǎn)是,人們可以在任何地方時(shí)間收、發(fā)信件解決了時(shí)空的限制,大大提高了工作效率,為辦公自動(dòng)化,商業(yè)活動(dòng)提供了很大便利。各類企業(yè)、學(xué)校、甚至于個(gè)人之間的業(yè)務(wù)交流越加依托于網(wǎng)絡(luò)通訊,電子郵件系統(tǒng)也越發(fā)成為企業(yè)、學(xué)校的主流級(jí)應(yīng)用。任務(wù)與進(jìn)度要求2015.3.9-2015.3.29選題確認(rèn)并完成開題報(bào)告、任務(wù)書的填寫、提交、審核2015.3.30-2015.4.12深入了解課題內(nèi)容、需求分析、確定系統(tǒng)框架、熟悉開發(fā)工具2015.4.13-2015.5.10完成課題概要設(shè)計(jì)和詳細(xì)設(shè)計(jì),代碼編寫、網(wǎng)頁(yè)制作,完成系統(tǒng)的大部分功能,初稿完成2015.5.11-2015.5.31進(jìn)行系統(tǒng)調(diào)試,并在調(diào)試中進(jìn)一步完善系統(tǒng)的各項(xiàng)功能,二稿完成2015.6.1-2015.6.6畢業(yè)設(shè)計(jì)(論文)的審核、修改及定稿并裝訂2015.6.7答辯主要參考文獻(xiàn)[1]徐方亮,錢朝陽(yáng),李泉.基于B/S結(jié)構(gòu)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)[J].數(shù)字技術(shù)與應(yīng)用,2010,(6):137-138[2]王紹飛.基于web的電子郵件系統(tǒng)[J].商情,2014,(17):320-321[3]謝宗旺,方旭升.基于Struts2和Spring框架的Web整合開發(fā)研究[J].價(jià)值工程,2011,(4):272-273[4]邱曉榮.基于MVC模式的Struts2框架在Web應(yīng)用開發(fā)中的實(shí)現(xiàn)[J].黑龍江科技信息,2012,(18):68-72[5]王彬,張計(jì)龍.Struts2框架的改進(jìn)與實(shí)現(xiàn)[J].大連海事大學(xué)學(xué)報(bào):自然科學(xué)版,2010,(2):56-58[6]Xiao,Shou-bai.ResearchonStrutsframeworkinthedevelopmentofMIS[J].EnergyProcedia,2011,(13):88-90起止日期2015年3月9日至2015年6月7日備注院長(zhǎng)教研室主任指導(dǎo)教師畢業(yè)設(shè)計(jì)(論文)開題報(bào)告表2015年3月23日姓名謝辰學(xué)院計(jì)算機(jī)科學(xué)與軟件專業(yè)軟件工程班級(jí)軟件1105題目基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)指導(dǎo)教師朱梅霞;侯鵬一、與本課題有關(guān)的國(guó)內(nèi)外研究情況、課題研究的主要內(nèi)容、目的和意義:與本課題有關(guān)的國(guó)內(nèi)外研究情況電子郵件本身起源比較早,所以到今天為止的幾十年間,電子郵件系統(tǒng)已經(jīng)發(fā)展成一個(gè)相對(duì)成熟穩(wěn)定的系統(tǒng)。國(guó)外研究狀況:目前電子郵件服務(wù)都是由專門的服務(wù)器提供,而主要額電子郵件服務(wù)器有一下兩大塊:一、基于Unix/Linux平臺(tái)的郵件系統(tǒng)1.Sendmail郵件系統(tǒng)(支持SMTP)和dovecot郵件系統(tǒng)(支持POP3)Sendmail可以說(shuō)是郵件的鼻祖,迄今為止有50多年的歷史。2.基于Postfix/Qmail的郵件系統(tǒng)。Postfix/Qmail技術(shù)是在Sendmail技術(shù)上發(fā)展起來(lái)的,迄今為止歷史不超過(guò)10年。二.基于Windows平臺(tái)的郵件系統(tǒng)1.微軟的Exchange郵件系統(tǒng),次系統(tǒng)由于和Windows整合,是企業(yè)中使用數(shù)量最多的郵件系統(tǒng)。2.IBMLotusDomino郵件系統(tǒng),此系統(tǒng)綜合功能較強(qiáng),大型企業(yè)使用較多,基于Postfix的郵件系統(tǒng)則需要有較強(qiáng)的技術(shù)力量才能實(shí)現(xiàn),但是性能可以達(dá)到非常高,而且安全性很好,同時(shí)軟件是開源免費(fèi)的。3.Scalix郵件系統(tǒng)。4.Zimbra郵件系統(tǒng)。5.MDeamon郵件系統(tǒng)。由于互聯(lián)網(wǎng)技術(shù)的更新?lián)Q代,電子郵件系統(tǒng)也在不斷更新,云服務(wù)及全終端互聯(lián)都是目前各大電子郵件服務(wù)商所發(fā)展的趨勢(shì)。國(guó)內(nèi)研究狀況:國(guó)內(nèi)的電子郵件業(yè)務(wù)相對(duì)起步不算早,但目前的技術(shù)發(fā)展也趨于穩(wěn)定。電子郵件服務(wù)商也處在百家爭(zhēng)鳴的階段,用戶根據(jù)自身狀況可以選擇的服務(wù)商可以有很多很多。網(wǎng)易和新浪算是國(guó)內(nèi)電子郵件系統(tǒng)起步較早的兩家,網(wǎng)易現(xiàn)在的電子郵件系統(tǒng)相對(duì)完善,技術(shù)也比較成熟,而騰訊由于收購(gòu)了foxmail使得騰旭在電子郵件領(lǐng)域的技術(shù)也是得到了很大的加強(qiáng)??梢哉f(shuō)國(guó)內(nèi)電子郵件系統(tǒng)的發(fā)展已經(jīng)到了和國(guó)外齊頭并進(jìn)的地步,在國(guó)內(nèi)下一個(gè)十五的計(jì)劃下,國(guó)內(nèi)因特網(wǎng)的發(fā)展將進(jìn)入下一代,那郵件服務(wù)同國(guó)外一樣也將想著云服務(wù)及全終端互聯(lián)的方向發(fā)展下去,但是與國(guó)外GOOGLE、yahoo等相比技術(shù)本身還有一定的落后。課題研究的主要內(nèi)容1.用戶注冊(cè)及登錄:客戶在注冊(cè)成功后成為系統(tǒng)的用戶,登錄后可以進(jìn)行郵件的收發(fā)等操作。2.收取郵件:用戶登錄系統(tǒng)時(shí)系統(tǒng)自動(dòng)提取該用戶的郵件,用戶點(diǎn)擊獲取的郵件可以查看郵件。3.搜索郵件:用戶登錄系統(tǒng)后通過(guò)選定條件進(jìn)行模糊查詢,系統(tǒng)默認(rèn)是主體+正文的搜索條件。4.郵件回復(fù)及轉(zhuǎn)發(fā):用戶登錄系統(tǒng)后進(jìn)入單封郵件,點(diǎn)擊回復(fù)或轉(zhuǎn)發(fā)按鈕即可回復(fù)轉(zhuǎn)發(fā)郵件。

5.寫信:用戶登錄系統(tǒng)后,點(diǎn)擊寫信按鈕即可寫信,用戶可以寫帶附件的郵件保存至草稿箱或發(fā)送出去。課題研究的主要的目的和意義一、目的:以JavaEE作為開發(fā)平臺(tái)運(yùn)用MVC模式開發(fā)思想采用Struts2框架技術(shù)完成一個(gè)輕量級(jí)的電子郵件系統(tǒng)。系統(tǒng)具有收發(fā)郵件、郵件管理、通訊錄、搜索等功能初步完成電子郵件系統(tǒng)的要求。二、意義:中國(guó)互聯(lián)網(wǎng)信息中心(CCNIC)2015年1月發(fā)布的第35次《中國(guó)互聯(lián)網(wǎng)絡(luò)發(fā)展?fàn)顩r統(tǒng)計(jì)報(bào)告》中表明在主要企業(yè)互聯(lián)網(wǎng)應(yīng)用普及率中,發(fā)送和接受電子郵件的普及率為83%,是各個(gè)應(yīng)用中最高,而在實(shí)際企業(yè)電子郵件的應(yīng)用中電子郵件系統(tǒng)太過(guò)冗余,許多繁復(fù)的功能自始至終未被使用,所以通過(guò)開發(fā)一個(gè)輕量級(jí)的系統(tǒng)來(lái)簡(jiǎn)化許多不必要的功能。本次畢業(yè)設(shè)計(jì)應(yīng)達(dá)到的目標(biāo)獨(dú)自自主的完成一個(gè)完整的軟件項(xiàng)目(本次為電子郵件系統(tǒng))的開發(fā)全過(guò)程,最終完成項(xiàng)目無(wú)重大BUG可以順利運(yùn)行各個(gè)預(yù)定模塊,完成相關(guān)論文編寫,對(duì)開發(fā)過(guò)程及開發(fā)細(xì)節(jié)以及個(gè)人體會(huì)進(jìn)行詳述。充分將所學(xué)知識(shí)運(yùn)用到需求分析、系統(tǒng)分析、代碼實(shí)現(xiàn)等各個(gè)階段,使自身適應(yīng)當(dāng)下環(huán)境下的輕量級(jí)軟件開發(fā),更好的為畢業(yè)之后踏入社會(huì)做好最充分的準(zhǔn)備。二、進(jìn)度及預(yù)期結(jié)果:起止日期主要內(nèi)容預(yù)期結(jié)果2015.3.9-2015.3.292015.3.30-2015.4.122015.4.13-2015.5.102015.5.11-2015.5.312015.6.1-2015.6.62015.6.7選題確認(rèn)并完成開題報(bào)告、任務(wù)書的填寫、提交、審核深入了解課題內(nèi)容、需求分析、確定系統(tǒng)框架、熟悉開發(fā)工具完成課題概要設(shè)計(jì)和詳細(xì)設(shè)計(jì),代碼編寫、網(wǎng)頁(yè)制作,完成系統(tǒng)的大部分功能,初稿完成進(jìn)行系統(tǒng)調(diào)試,并在調(diào)試中進(jìn)一步完善系統(tǒng)的各項(xiàng)功能,二稿完成畢業(yè)設(shè)計(jì)(論文)的審核、修改及定稿并裝訂答辯完成完成完成完成完成完成完成課題的現(xiàn)有條件硬件:IntelCorei5-2410M8G內(nèi)存640G硬盤軟件:MicrosoftWindows7ProfessionalMyEclipse6.0

ApacheTomcat5.5

MySQL5.5

ApacheJamesMailServer2.3.1參考文獻(xiàn):[1]徐方亮,錢朝陽(yáng),李泉.基于B/S結(jié)構(gòu)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)[J].數(shù)字技術(shù)與應(yīng)用,2010,(6):137-138[2]王紹飛.基于web的電子郵件系統(tǒng)[J].商情,2014,(17):320-321[3]謝宗旺,方旭升.基于Struts2和Spring框架的Web整合開發(fā)研究[J].價(jià)值工程,2011,(4):272-273[4]邱曉榮.基于MVC模式的Struts2框架在Web應(yīng)用開發(fā)中的實(shí)現(xiàn)[J].黑龍江科技信息,2012,(18):68-72[5]王彬,張計(jì)龍.Struts2框架的改進(jìn)與實(shí)現(xiàn)[J].大連海事大學(xué)學(xué)報(bào):自然科學(xué)版,2010,(2):56-58[6]Xiao,Shou-bai.ResearchonStrutsframeworkinthedevelopmentofMIS[J].EnergyProcedia,2011,(13):88-90審查意見指導(dǎo)教師:年月日學(xué)院意見主管領(lǐng)導(dǎo):年月日天津工業(yè)大學(xué)本科畢業(yè)設(shè)計(jì)(論文)評(píng)閱表(論文類)題目基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)學(xué)生姓名謝辰學(xué)生班級(jí)軟件1105指導(dǎo)教師姓名朱梅霞;侯鵬評(píng)審項(xiàng)目指標(biāo)滿分評(píng)分選題能體現(xiàn)本專業(yè)培養(yǎng)目標(biāo),使學(xué)生得到較全面訓(xùn)練。題目大小、難度適中,學(xué)生工作量飽滿,經(jīng)努力能完成。10題目與生產(chǎn)、科研等實(shí)際問(wèn)題結(jié)合緊密。10課題調(diào)研、文獻(xiàn)檢索能獨(dú)立查閱文獻(xiàn)以及從事其他形式的調(diào)研,能較好地理解課題任務(wù)并提出實(shí)施方案;有分析整理各類信息,從中獲取新知識(shí)的能力。15論文撰寫結(jié)構(gòu)嚴(yán)謹(jǐn),理論、觀點(diǎn)、概念表達(dá)準(zhǔn)確、清晰。10文字通順,用語(yǔ)正確,基本無(wú)錯(cuò)別字和病句,圖表清楚,書寫格式符合規(guī)范。10外文應(yīng)用能正確引用外文文獻(xiàn),翻譯準(zhǔn)確,文字流暢。5論文水平論文論點(diǎn)正確,論點(diǎn)與論據(jù)協(xié)調(diào)一致,論據(jù)充分支持論點(diǎn),論證過(guò)程有說(shuō)服力。15有必要的數(shù)據(jù)、資料支持,數(shù)據(jù)、資料翔實(shí)可靠,得出的結(jié)論有可驗(yàn)性。15論文有獨(dú)到見解或有一定實(shí)用價(jià)值。10合計(jì)100意見及建議:評(píng)閱人簽名: 年月日天津工業(yè)大學(xué)畢業(yè)設(shè)計(jì)(論文)成績(jī)考核表學(xué)生姓名謝辰學(xué)院名稱計(jì)算機(jī)科學(xué)與軟件專業(yè)班級(jí)軟件1105題目基于Struts2技術(shù)的電子郵件系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)1.畢業(yè)設(shè)計(jì)(論文)指導(dǎo)教師評(píng)語(yǔ)及成績(jī):成績(jī):成績(jī):指導(dǎo)教師簽字:年月日2.畢業(yè)設(shè)計(jì)(論文)答辯委員會(huì)評(píng)語(yǔ)及成績(jī):成績(jī):成績(jī):答辯主席(或組長(zhǎng))簽字:年月日3.畢業(yè)設(shè)計(jì)(論文)總成績(jī):a.指導(dǎo)教師給定成績(jī)b.評(píng)閱教師給定成績(jī)c.畢業(yè)答辯成績(jī)總成績(jī)(a×0.5+b×0.2+c×0.3)摘要通過(guò)短短幾十年的發(fā)展,交流情感的書信已經(jīng)從過(guò)去的實(shí)體信件一步一步演變?yōu)榻駮r(shí)今日的電子郵件,與傳統(tǒng)的方式相比,電子郵件的優(yōu)勢(shì)顯而易見:方便、快捷、收費(fèi)低廉等這些都成為人們熱捧的原因。中國(guó)互聯(lián)網(wǎng)信息中心(CCNIC)2015年1月發(fā)布的第35次《中國(guó)互聯(lián)網(wǎng)絡(luò)發(fā)展?fàn)顩r統(tǒng)計(jì)報(bào)告》中表明在主要企業(yè)互聯(lián)網(wǎng)應(yīng)用普及率中,發(fā)送和接受電子郵件的普及率為83%,是各個(gè)應(yīng)用中最高,而在實(shí)際企業(yè)電子郵件的應(yīng)用中電子郵件系統(tǒng)太過(guò)冗余,許多繁復(fù)的功能自始至終未被使用,所以通過(guò)開發(fā)一個(gè)輕量級(jí)的系統(tǒng)來(lái)簡(jiǎn)化許多不必要的功能。本次課題面向的是企業(yè)內(nèi)部郵件服務(wù),通過(guò)本系統(tǒng)的實(shí)現(xiàn)可有效降低雇員相互溝通的成本,縮短溝通過(guò)程中所需時(shí)間,大幅提高效率,是具有一定廣泛性的推廣價(jià)值。本次課題基于Struts2技術(shù)的電子郵件的實(shí)現(xiàn)是使用了現(xiàn)階段使用度較高的計(jì)算機(jī)語(yǔ)言——java,以及其中較為成熟的SSH框架開發(fā)而成的。數(shù)據(jù)庫(kù)方面則選擇使用了跨平臺(tái)性較強(qiáng)的MySQL數(shù)據(jù)庫(kù)。而整個(gè)課題中設(shè)計(jì)的郵件服務(wù)器則使用了開源且免費(fèi)的ApacheJames郵件服務(wù)器。本論文論述了基于Struts2技術(shù)的電子郵件系統(tǒng)的整體背景、現(xiàn)階段研究狀況。對(duì)系統(tǒng)開發(fā)中所使用的語(yǔ)言、工具及涉及的相關(guān)技術(shù)進(jìn)行一定程度的闡述。按照軟件開發(fā)的周期對(duì)系統(tǒng)分析、初步設(shè)計(jì)、詳細(xì)設(shè)計(jì)、具體代碼實(shí)現(xiàn)以及系統(tǒng)測(cè)試的流程進(jìn)行闡述。關(guān)鍵詞:電子郵件;Java;MySQL;James郵件服務(wù)器ABSTRACTThroughjustafewyearsofdevelopment,theexchangeoflettershasbeenfurtherevolutionofemotionallettersfromentitieslaststeptoe-mailtoday,comparedwiththetraditionalway,theadvantagesofe-mailareobvious:convenient,fast,low-cost,etc.Thesehavebecomethereasonpeopleblitz.35th"StatisticalReportonInternetDevelopmentinChina"ChinaInternetNetworkInformationCenter(CCNIC)2015releasedinJanuaryshowedthattheprevalenceofmajorcorporateInternetapplications,sendandreceivee-mailpenetrationrateof83%,istheindividualapplicationofthehighestcorporatee-mailandintheapplicationoftheactuale-mailsystemistooredundant,manycomplicatedfunctionsthroughoutunused,sobydevelopingalightweightsystemtosimplifymanyunnecessaryfeatures.Theissueisintendedforinternalmailservice,byimplementingthissystemcancommunicatewitheachothereffectivelyreduceemployeecostsandshortenthetimerequiredforthecommunicationprocess,greatlyimproveefficiency,itistopromotethevalueofacertainuniversality.ThetasktoachieveStruts2technology-basede-mailistheuseofahigherstageofuseofcomputerlanguage--java,aswellasoneofthemorematureSSHframeworktodevelop.Databasesthenchoosetousethestrongcross-platformMySQLdatabase.ThewholeissueinthedesignofthemailserverusestheopensourceandfreeApacheJamesmailserver.Thispaperdiscussestheoverallcontextofthee-mailsystemStruts2technology,basedonresearchsituationatthisstage.Onthelanguageusedinthesystemdevelopment,toolsandrelatedtechnologiesinvolvedsomedegreeofelaboration.Accordingtothesoftwaredevelopmentcycleforsystemsanalysis,preliminarydesign,detaileddesign,thespecificcodeandsystemtestingprocesswillbeexplained.Keywords:E-mail;Java;MySQL;Jamesmailserver目錄TOC\t"副標(biāo)題,2,標(biāo)題,1,標(biāo)題特別,1"第一章前言 天津工業(yè)大學(xué)2015屆本科生畢業(yè)設(shè)計(jì)(論文)參考文獻(xiàn)[1]張宗耀.《計(jì)算機(jī)網(wǎng)絡(luò)與辦公自動(dòng)化》.西安電子科技大學(xué)出版社大學(xué)學(xué)報(bào),2005,29(4):29~32[2]LanSommerville.SoftwareEngineering.Addison-Wesley.SixEdition.[3]孫衛(wèi)琴.精通Struts——基于MVC的java.web設(shè)計(jì)與開發(fā).人民郵電出版社,2004,8.[4]戎偉.精通Struts——Java流行服務(wù)器、框架及工具整合應(yīng)用.人民郵電出版社,2006,10.[5]羅時(shí)飛.精通Spring——深入J2EE開發(fā)核心技術(shù).電子工業(yè)出版社,2008,1.[6]RodStephens.ExpertOne-on-OneVisualBasic2005DesignandDevelopment.WROX.2007[7]孫衛(wèi)琴.精通Hibernate.電子工業(yè)出版社,2005,5.[8]SasbaPacbev.深入理解MySQL核心技術(shù).中國(guó)電力出版社,2009,1.[9]劉中兵.精通Tomcat.清華大學(xué)出版社,2007,5.[10]東箭工作室.電子郵件完全手冊(cè).清華大學(xué)出版社,2006,1.[11]張瑋.jQuery基礎(chǔ)教程.人民郵件出版社,2008,5.[12]張孝祥.Java郵件開發(fā)詳解.電子工業(yè)出版社,2007,4.[13]齊治昌等.軟件工程(第二版)[M].高等教育出版社,2004:165~178.[14]鄭明輝.基于UML的需求分析過(guò)程研究[J].微機(jī)發(fā)展,2004,5:50~53.[15]JeffSmith,AndrewC.Montz.EnhancedAIRNowDataCollectionUsingXMLandInternetTechnologies[J].DepartmentofEnvironmentalQuality.2008,12(11):10-15.[16]MartinFowler[美].金芝高.標(biāo)準(zhǔn)對(duì)象建模語(yǔ)言簡(jiǎn)明指南.清華大學(xué)出版社.[17]ArnoldDoray.BeginningApacheStruts:FromNovicetoProfessional[M].Apress.[18]Patton,R.[美].張小松.軟件測(cè)試.機(jī)械工業(yè)出版社,2006,10.[19]LisaCrispin[美].孫偉峰.敏捷軟件測(cè)試.清華大學(xué)出版社,2010,10.[20]陳汶濱.軟件測(cè)試技術(shù)基礎(chǔ).清華大學(xué)出版社,2008,7.附錄Ⅰ代碼發(fā)送郵件代碼SendMail.java:publicclassSendMail{ privateMailBeanmail=null; privateSessionsession=null; publicSendMail(MailBeanmail){ this.mail=mail; } /**郵件創(chuàng)建*/ publicMimeMessagecreateMimeMessage()throwsAddressException, MessagingException,UnsupportedEncodingException{ session=MailSession.createSession( "cn/edu/pdsu/service/mail/perties",mail.getAuth());//創(chuàng)建session MimeMessagemessage=newMimeMessage(session);//創(chuàng)建整體郵件 //設(shè)置郵件基本信息 setMimeMessageInfo(message); MimeMultipartmultipart=null; //創(chuàng)建什么都不含的郵件體(alternative) if(mail.getContent()!=null&&mail.getContent().length()>0) multipart=createAlternative(multipart); //創(chuàng)建含有內(nèi)嵌資源的郵件體(related) if(mail.getResource()!=null&&mail.getResource().length()>0) multipart=createRelated(multipart); //創(chuàng)建含有附件的郵件體(mixed) if(mail.getFile()!=null&&mail.getFile().length()>0) multipart=createMixed(multipart); //添加multipart到郵件內(nèi)容上 if(multipart==null) multipart=createAlternative(multipart); message.setContent(multipart); message.saveChanges(); returnmessage; } //創(chuàng)建什么都不含的郵件體(alternative) privateMimeMultipartcreateAlternative(MimeMultipartmultipart) throwsMessagingException{ multipart=newMimeMultipart("alternative"); MimeBodyParthtml=newMimeBodyPart(); html.setContent(mail.getContent(),"text/html;charset=UTF-8"); multipart.addBodyPart(html); returnmultipart; } //創(chuàng)建含有內(nèi)嵌資源的郵件體(related) privateMimeMultipartcreateRelated(MimeMultipartmultipart) throwsMessagingException{ MimeBodyPartalternative=newMimeBodyPart(); alternative.setContent(multipart); MimeMultipartrelated=newMimeMultipart("related"); related.addBodyPart(alternative); //添加內(nèi)嵌資源 related=addResource(related); returnrelated; } //添加內(nèi)嵌資源 privateMimeMultipartaddResource(MimeMultipartrelated) throwsMessagingException{ Stringresources[]=mail.getResource().split(","); for(Stringres:resources){ MimeBodyPartimg=newMimeBodyPart(); FileDataSourcefds=newFileDataSource(res); img.setDataHandler(newDataHandler(fds)); img.setContentID(System.currentTimeMillis()+fds.getName()); related.addBodyPart(img); } returnrelated; } //創(chuàng)建含有附件的郵件體(mixed) privateMimeMultipartcreateMixed(MimeMultipartmultipart) throwsMessagingException,UnsupportedEncodingException{ MimeBodyPartrelated=newMimeBodyPart(); //添加multipart到郵件內(nèi)容上 if(multipart==null) multipart=createAlternative(multipart); related.setContent(multipart); MimeMultipartmixed=newMimeMultipart("mixed"); mixed.addBodyPart(related); //添加附件 mixed=addAttachment(mixed); returnmixed; } //添加附件 privateMimeMultipartaddAttachment(MimeMultipartmixed) throwsMessagingException,UnsupportedEncodingException{ Stringfiles[]=mail.getFile().split(","); for(Stringfile:files){ MimeBodyPartattachment=newMimeBodyPart(); FileDataSourcefds=newFileDataSource(file); attachment.setDataHandler(newDataHandler(fds)); attachment.setFileName(MimeUtility.encodeText(fds.getName(), "UTF-8","Q")); mixed.addBodyPart(attachment); } returnmixed; } //設(shè)置郵件具體信息 privatevoidsetMimeMessageInfo(MimeMessagemessage) throwsAddressException,MessagingException, UnsupportedEncodingException{ if(mail.getFrom()!=null&&!"".equals(mail.getFrom())){ message.setFrom(newInternetAddress(encode(mail.getFrom())));//設(shè)置發(fā)件人 message.setSender(newInternetAddress(encode(mail.getFrom()))); } if(mail.getTo()!=null&&!"".equals(mail.getTo())) message.setRecipients(RecipientType.TO, InternetAddress.parse(encode(mail.getTo())));//設(shè)置收件人 if(mail.getCc()!=null&&!"".equals(mail.getCc())) message.setRecipients(RecipientType.CC, InternetAddress.parse(encode(mail.getCc())));//設(shè)置抄送人 if(mail.getBcc()!=null&&!"".equals(mail.getBcc())) message.setRecipients(RecipientType.BCC, InternetAddress.parse(encode(mail.getBcc())));//設(shè)置密送人 if(mail.getSubject()!=null&&!"".equals(mail.getSubject())) message.setSubject(mail.getSubject(),"UTF-8"); //是否緊急 if(mail.isExigence()){//指定郵件的優(yōu)先級(jí),1:緊急,3:普通,5:緩慢 message.setHeader("X-Priority","1"); }else{ message.setHeader("X-Priority","3"); } message.setSentDate(mail.getDate()); } //對(duì)中文進(jìn)行編碼 privateStringencode(Stringmailadd)throwsUnsupportedEncodingException{ Patternp=Ppile("(\"(.*?)\"?<)");//查找所有("中文"<)的格式 StringBuffersb=newStringBuffer(); Matchermatcher=p.matcher(mailadd); while(matcher.find()){ matcher.appendReplacement(sb, MimeUtility.encodeText(matcher.group(2),"UTF-8","B") +"<"); } matcher.appendTail(sb); System.out.println(sb.toString()); returnsb.toString(); } /** *發(fā)送郵件 */ publicvoidsendMail()throwsAddressException,MessagingException, UnsupportedEncodingException{ MimeMessagemessage=createMimeMessage(); //發(fā)送消息 Transport.send(message); } /** *發(fā)送指定郵件體的郵件 */ publicvoidsendMail(MimeMessagemessage)throwsAddressException, MessagingException,UnsupportedEncodingException{ //發(fā)送消息 Transport.send(message); }}收取電子郵件代碼ReceiveMail.java:publicclassReceiveMail{ privateStringhost="localhost"; privateStringusername=null; privateStringpassword=null; privateIMAPStorestore=null; privateMailInfomailInfo=null; privateIMAPFolderfolder=null; privatebooleansaveAttachments=false;//是否保存附件 privateStringattachmentName=null;//附件的名稱 privateStringfolderName=null;//郵件夾名稱 privateStringpath=null;//附件保存的位置 privateStringBuffercontent=newStringBuffer(); privateStringBufferfilename=newStringBuffer(); /** *初始化接收郵件的構(gòu)造方法 * *@paramusername *用戶名 *@parampassword *密碼 *@throwsMessagingException */ publicReceiveMail(Stringusername,Stringpassword) throwsMessagingException{ this.username=username; this.password=password; mailInfo=newMailInfo(); connection();//連接到郵件服務(wù)器 } //創(chuàng)建與服務(wù)器的連接 privatevoidconnection()throwsMessagingException{ Sessionsession=MailSession .getInstance("cn/edu/pdsu/service/mail/perties"); store=(IMAPStore)session.getStore(); //連接到郵件服務(wù)器 store.connect(host,username,password); } //打開指定的收件夾folderName,model文件夾打開模式 publicIMAPFolderopenFolder(StringfolderName,intmodel) throwsMessagingException{ this.folderName=folderName; folder=(IMAPFolder)store.getFolder(folderName); if(folder.exists()) folder.open(model); else{ folder.create(Folder.HOLDS_MESSAGES); folder.open(model); } returnfolder; } //保存郵件到指定的收件夾中 publicbooleancopyMessage(Message[]message,StringfolderName) throwsMessagingException{ openFolder(folderName,Folder.READ_WRITE);//打開指定的郵件夾 folder.appendMessages(message);//將郵件追加到指定的郵件夾中 returnfalse; } //移動(dòng)郵件到指定的郵件夾下 publicvoidmoveMessage(StringsrcFolder,StringdestFolder,long[]uid) throwsMessagingException{ IMAPFoldersrc=openFolder(srcFolder,Folder.READ_WRITE); IMAPFolderdest=openFolder(destFolder,Folder.READ_WRITE); Message[]messages=src.getMessagesByUID(uid); src.copyMessages(messages,dest);//復(fù)制郵件到指定的郵件夾中 src.setFlags(messages,Flag.DELETED.getFlag(),true);//將源郵件夾中的郵件設(shè)置為刪除 if(dest.isOpen()){//關(guān)閉目標(biāo)郵件夾 dest.close(true); } if(src.isOpen()){//關(guān)閉目標(biāo)郵件夾 src.close(true); } } //徹底刪除郵件 publicvoiddeleteMessage(StringfolderType,long[]uid) throwsMessagingException{ IMAPFolderfolder=openFolder(folderType,Folder.READ_WRITE); Message[]messages=folder.getMessagesByUID(uid); folder.setFlags(messages,Flag.DELETED.getFlag(),true);//將源郵件夾中的郵件設(shè)置為刪除 if(folder.isOpen()){//關(guān)閉目標(biāo)郵件夾 folder.close(true); } }} 附錄Ⅱ文獻(xiàn)翻譯英文文獻(xiàn)Struts2introductionStruts2isthenextgenerationofStrutsproducts.

ThenewStruts2frameworkismergedwiththetechnologyStrutsbasedonWebWorkand[3]..

ThenewStruts2architectureandthearchitectureofStruts1varygreatly.Struts2webworkasthecore,theinterceptormechanismtodealwiththeuser'srequest,thisdesignalsomakesbusinesslogiccontrollercantotheservletAPIcompleteoff,sotheStruts2canbeunderstoodaswebworkofupdatedproducts.

BecauseStruts2andWebWorkhavemuchtochange,butonlyalittleofthechangeofStruts2relativetoStruts1.ThroughtheaboveunderstandingofthestructureofStruts2,wefoundthatStruts2hasmadegreatimprovementonStruts1..

Mainlyinthefollowingaspects:(1)intheimplementationoftheAction:Struts1requiresthatitbeunifiedtoexpandfromtheActionclass,whiletheStruts2canbeanordinaryPOJO.(2)threadmodel:Action'sStruts1worksinsingletonmode,andaActioninstancehandlesallrequests.

ActionStruts2isarequestforaninstanceofthe.

Thereisnothreadsafeproblem.(3)Servletdependency:theActionStruts1dependsonAPIServlet,suchastheparametersoftheexecuteActionmethodincludingrequestandresponseobjects.

Thismakestheprogramdifficulttotest..

ActionServletnolongerdependsonAPIStruts2,isconducivetotesting,andtoachieveTDD.(4)thepackagerequestparameter:theparametersoftheActionFormobjectencapsulationrequestareenforcedinStruts1.

Struts2canchoosetousethePOJOclasstoencapsulatetherequestparameter,ordirectlyusetheActionattribute.(5)theexpressionlanguage:Struts1integratesEL,buttheELsupportsthecollectionandtheindexisnotstrong,Struts2integratesOGNL(GraphNavigationLanguageObject).(6)thebindingvaluetotheviewtechnology:Struts1usesthestandardJSP,Struts2usestheValueStacktechnology.(7)typeconversion:theActionFormoftheStruts1usestheattributeoftheStringtype.

Struts2useOGNLconversion,moreconvenientuse.(8)datavalidation:Struts1supportsthecovervalidatemethodorusetheValidatorframework.

Struts2supportsrewritingthevalidatemethodortheverificationframeworkusingXWork.(9)thecontrastofActionexecutioncontrol:Struts1supportseachmoduletoarequestprocessing,butallActioninthemodulemustsharethesamelifecycle.

Struts2issupportedbytheinterceptorstacktocreatedifferentlifecycleforeachAction.SpringintroductionSpring[5]RodJohnsonOne-on-OneJ2EEDesignandDevelopment[6]Expertinabooktoexplainthespecificimplementationofthedesignideas.

ThespringframeworkJ2EEplatformfordeveloperstoprovideisan"objectmanagementtechnology,isfordeveloperstosolvebetweenthelifecycleofanobject,theobjectdependenciesestablished,theobjectcacheimplementationaspectsincludingmanagementtechnology.Thespringframeworkisalightweightinversionofcontrol(IOC)technologyandorientedviewprogramming(AOP)technologyofcontainerframework,thespringframeworkofIOCtechnologyinJ2EEplatformadvocatedbythecontainertorealizeobjectlifecyclemanagementcouldbeachieved,andtheuseofAOPtechnologyinthespringframeworkinJ2EEplatformadvocatedtheseparationofapplicationsystembusinesslogiccomponentsandgeneraltechnicalservicescomponentcanbeachieved.

Theapplicationsystemdeveloperscanachievethedesignandimplementationof"decoupling"and"outofthevessel"afterapplyingSpringframeworkintheapplicationsystem..TheSpringframeiscomposedof7modulesthatarewelldefinedandindependent..HibernateintroductionHibernateisabridgebetweentheapplicationofJavaandthedatabase,throughthesimpleencapsulationofJDBC,Javaprogrammerscanuseorientedobjectthinkingoperationdatasheet,nolongerconsiderthedataaccessdetails,canfocusonthedevelopmentofbusinesslogic,itoflayeredsoftwaredofurtherrefinement,separatethedatapersistenceandbusinesslogicanddatabase,forsoftwaremaintenance[7].

HibernatecanbeappliedinanyuseofJDBCoccasionscannotonlyusedintheJavaclientprogram,canalsobeusedintheservletandJSPWebapplication,isthemostrevolutionary,hibernatecanreplaceCMPinapplicationofEJBofJ2EEarchitecturetocompletethetaskofdatapersistence.MyEclipsedevelopmenttoolsEclipseisanopensource,Javabasedextensibledevelopmentplatform.

Initsowncase,itisjustaframeworkandasetofservicesforbuildingthedevelopmentenvironmentthroughtheplug-incomponents.

Fortunately,Eclipsecomeswithastandardplug-inset,includingJavadevelopmenttools(DevelopmentToolsJava,JDT).Eclipsealsoincludestheplug-indevelopmentenvironment(plugindevelopmentenvironment,thePDE),thecomponentmainlyaimedatsoftwaredeveloperswhowanttoextendeclipse,becauseitallowsthemtobuildtoolsthatintegratedseamlesslywiththeeclipseenvironment.MyEclipseisaverygoodforthedevelopmentofJava,J2EEEclipsePlug-inset,MyEclipsefunctionisverypowerful,verybroadsupport,especiallytheKaiyuanproductsupportisverynice.

MyEclipseenterpriseworkbench(MyEclipseenterpriseworkbench,referredtoasMyEclipse)isanextensionoftheeclipseide.Byusingit,wecaninthedatabaseandtheJavaEEdevelopment,publishingandapplicationprogramserverintegrationgreatlyimproveworkefficiency.

ItisafeaturerichJavaEEintegrateddevelopmentenvironment,includingcompletecoding,debugging,testingandreleasefunctions,completesupportHTML,Struts,JSP,CSS,Javascript,SQL,Hibernate.MySQLintroductionMySQLisarealmulti-user,multi-threadedSQLdatabaseserver[8].

SQL(StructuredQueryLanguage)isthemostpopularandstandardizeddatabaselanguageintheworld..

MySQLisaclient/serverarchitecture,whichconsistsofaserverGuardianprogrammysqldandalotofdifferentclientprogramsandlibraries.

SQLisastandardizedlanguage,itmakesstorage,updateandaccessinformationeasier.

Forexample,youcanusetheSQLlanguagetoretrieveproductinformationandstorecustomerinformationforawebsite,whileMySQLisfastandflexibletoallowyoutostoretherecordandimage.ThemaingoaloftheMySQLisfast,robustandeasytouse.

InitiallybecauseweneedsuchaSQLserver,itcandealwithanyexpensivehardwareplatformprovidesdatabasemanufacturersinanorderofmagnitudeoflargedatabases,butfaster,MySQLdeveloped.MySQLisafast,multi-threaded,multi-userandrobustSQLdatabaseserver.

TheMySQLserversupportstheuseofkeytasks,heavyloadproductionsystems,andcanalsobeembeddedinalargeconfigurationsoftwareto.2.6TomcatserverprofileTomcatisafreeopensourceSerlvetcontainer,whichisacoreprojectoftheApacheprojectoftheJakartafoundation,developedbyApache,Sunandsomeothercompaniesandindividuals.

WiththeparticipationandsupportofSun,thelatestServletandJspspecificationcanalwaysbereflectedinTomcat.

Tomcatisstableindependentofwebserverandservletcontainer,however,thefunctionofthewebserverisnotasgoodasthemanymorerobustwebserver,suchasApacheWebserver(forexample,Tomcatwithoutalotofselectivemodule).

However,Tomcatisafreeopensourcesoftware,andtherearemanyexpertscommittedtoitsdevelopment.Tomcatisasmalllightweightapplicationserver[9],inwhichsmallandmediumsystemsandconcurrentaccesstotheuserisnotalotofoccasionsisgenerallyused,isthedevelopmentandcommissioningoftheJSPprogrampreferred.

Forabeginner,thiscanbeconsideredwhenconfiguringaApacheserveronamachinethatcanuseittorespondtorequestsforaccesstoaHTMLpage.

Infact,theTomcatpartistheApacheserverextension,butitisrunningindependently,sowhenyourunTomcat,itisactuallyrunningindependentlyasanindependentprocesswithApache.JamesmailserverprofileApacheJavamailservergenerallyreferstotheApacheorganizationdevelopmentofJames[10],itisalightweight,safe100%pureJavaservertoachieve.

NotonlythatJamescanalsoprovidemorefunctionality,thankstoJamesprovidesaplug-inarchitectureandprotocolsMailetinfrastructuretogiveus,itcanletususeservletswebservermailprocessing.

Emailserviceeverywhere,beganasaDARPA(DefenseAdvancedResearchProjectsAgency)aplanandthefinaldevelopmentfortheInternet,butJamesbecamethebreakthefirstapplicationofthetraditionalrules.JavaApachea.k.a.The(ApacheJamesJava)isa100%SMTPandPOP3mailserverrealized,andhealsoachievedthefunctionoftheNNTPnewsserver.

Jameswasdesignedtobeacomplete,portable,corporatemailenginesolution,andhewasfullybasedonthecurrentlyavailableopenprotocol.

Jamesisamailapplicationplatform.

TheApacheorganizationprovidesasetofJavaAPImailetAPI,usingMailetAPI,youcanaccordingtotheirownneedswiththeJavalanguagewritingcodetothemailpersonalizedtreatment.

Mailetcangenerateanautomaticreply,updatethedatabase,stopspam,establishthenewsfile,oranyofthefunctionswecanimagine.

Mailetiscloselyrelatedtothemessageadapter(Matcher),amessageadaptercanjudgewhetherMailettoamailserver.Jameswasdesignedtoachieveseveralgoalsoftheobjectives.

Forinstance,itusestheJavadevelopmenttosuitthebiggestlightline,itprovidesalotofsecurityfeaturesforprotectingtheserverrunningenvironmentsecurityalsoprovidessecurityservices.

Jamesismultithreaded,itusesalotofAvalonarchitecturetoprovidethefunctionality.Jamesprovidesaperfectservice,includingafullyoperationalEmailserver.

TheseservicesareprimarilyMactherandMailetAPIimplementations,thesetwoAPIprovidestheEmailinspectionandprocessingfunctions.

Jamessupportstandarde-mailprotocol(SMTP,POP3,IMAP).Italsoprovidessomeadditionalfunctionality.Itusesthelooselycoupleddesignplug-inabstractedfromtheprotocolmessageframe.

Thisdesignisveryuseful,sothatwecantakeJamesasacommonmessagingserverorprovidesupportforinstantmessaging.JamesamoreimportantdesigngoalistoproposetheMailetconcept,Mailetprovidesafulllifecyclefordevelopingemailapplications.

Ofcourse,youcanalsouseotherMTA(messagetransferagent)here,suchassendmailtodoweneedtoprovideaprocedurecallandtransmitthedatatoittocompletethework.However,JameshasofferedamoresimpleanduniversalAPItoperformthesetasks.二、中文翻譯Struts2簡(jiǎn)介Struts2是Struts的下一代產(chǎn)品。是在Struts和WebWork的技術(shù)[3]基礎(chǔ)上進(jìn)行了合并,全新的Struts2框架。其全新的Struts2的體系結(jié)構(gòu)與Struts1的體系結(jié)構(gòu)的差別巨大。Struts2以WebWork為核心,采用攔截器的機(jī)制來(lái)處理用戶的請(qǐng)求,這樣的設(shè)計(jì)也使得業(yè)務(wù)邏輯控制器能夠與ServletAPI完全脫離開,所以Struts2可以理解為WebWork的更新產(chǎn)品。因?yàn)镾truts2和Struts1有著太大的變化,但是相對(duì)于WebWork,Struts2只有很小的變化。通過(guò)上面對(duì)Struts2體系結(jié)構(gòu)[4]的了解,我們發(fā)現(xiàn)Struts2

溫馨提示

  • 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)論