已阅读5页,还剩26页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
基于MVC的WEB文章系统总体框架、文章显示、日志管理、验证码模块模块开发卷宗1标题软件系统名称和标识符名称基于MVC的WEB文章系统标识符WEB文章系统模块名称和标识符名称系统总体框架、日志管理、EMAIL在线回复、验证码标识符框架、日志、验证码程序编制员签名李正峰修改完成日期2005528卷宗序号(说明本卷宗在整个卷宗中的序号)编排日期20055282模块开发情况表3功能说明1、总体框架网站的总体架构设计2、文章显示对添加的文章/公告在网页中以标题列表、完全显示等方式分类显示出来,并可以添加用户评论以及分页显示。3、日志管理对后台的操作完全记录,并且以列表的形式显示每条日志。4、EMAIL自动回复用户注册成功,自动在线通过用户的EMAIL地址给予回复,向用户发送欢迎信息,无需任何人工干预。5、验证码管理员登录后台管理时,需要在登录的时候输入验证码,验证正确才能登录后台。以防止暴力破解管理员用户密码。4设计说明1、总体框架模块功能考虑网站的总体架构,由于是网上文章管理系统,要符合一般网站的要求,所以使用了流行的JSPWEB编程语言,显示页面使用STRUTS技术,尽量简化开发,充分利用了其MVC模式的优越性,后台管理部分使用JAVABEANJSP开发,做到逻辑处理与显示的分离。流程分析2、文章显示模块模块功能本模块是整个系统中的显示层,负责文章的显示功能,包括列表显示,内容显示,分页管理,用户评论等。本层使用JAVA中的STRUTS框架进行开发,充分利用了其MVC模式的优越性。流程分析用户界面3、日志管理模块模块功能记录管理员后台管理的所有操作,以便出现管理错误,可以很快的查找出是哪个用户做的什么操作,方便恢复。实现了网站管理的安全性。本模块使用一个用于日志记录的APACHE开源项目LOG4J进行开发,此项目经过长期的实践检验,被认为是JAVA日志管理方面最优秀的解决方案之一。流程分析用户界面4、EMAIL自动回复模块功能读取用户注册信息中的EMAIL信息,按照预先设定好的信件内容,对注册用户自动发送欢迎注册邮件。本功能使用JAVAMAIL编写,使网站具有在线发送EMAIL的功能。流程分析5、验证码模块功能通过随机函数,生成一个字符串,并把字符串生成JPG图片,显示在管理员登录界面上,管理员登录后台管理时,需要在登录的时候输入验证码,验证正确才能登录后台。以防止暴力破解管理员用户密码。用户界面5数据字典用户表(USERS)字段名称描述数据类型字段长度可否为空IDID号INTAUTO_INCREMENT否USERNAME管理员名称VARCHAR20否PASSWORD管理员密码VARCHAR25否SEX性别INT否NICKNAME昵称VARCHAR50否QUESTION密码保护问题VARCHAR100否ANSWER密码保护答案VARCHAR100否BIRTHDAY生日DATETIME否QQQQ号码INT否UCUC号码INT否ADDRESS地址VARCHAR200否EMAILEMAILVARCHAR50否SELFDESC个人描述VARCHAR255否ARTICLES文章数INT否REGISTRYIP注册IPVARCHAR50否REGISTRYDATE注册时间DATETIME否LASTLOGIN最后登陆时间DATETIME否LOGINTIMES登陆次数INT否CHARM魅力值INT否ISACTIVE帐号是否被激活INT否ISADMIN是否是管理员INT否VERIFYCODE激活代码VARCHAR50否文章分类表(CATEGORY)字段名称描述数据类型字段长度可否为空IDID号INTAUTO_INCREMENT否PARENTID父节点INT否NAME名称VARCHAR50否FULLNAMEFULLNAME全称VARCHAR250否文章表(ARTICLE)字段名称描述数据类型字段长度可否为空IDID号INTAUTO_INCREMENT否CATEGORY文章分类INT否TITLE文章标题VARCHAR50否CONTENT文章内容TEXT否HITS点击数INT否AUTHOR文章作者VARCHAR20否ADDTIME添加时间DATETIME否KEYWORD关键字VARCHAR30否ISRECOMMANDATION是否推荐INT否EDITOR编辑VARCHAR20否WRITEFROM来自VARCHAR30否评论表(REMARK)字段名称描述数据类型字段长度可否为空IDID号INTAUTO_INCREMENT否NEWSID所属文章IDINT否REUSER回复人VARCHAR50否RECONTENT回复内容VARCHAR255否MAIL回复人EMAILVARCHAR30否REDATE回复时间DATETIME否REIP回复IPVARCHAR50否日志表(LOGS)字段名称描述数据类型字段长度可否为空IDID号INTAUTO_INCREMENT否USERNAME登陆管理员VARCHAR30否EVENT操作事件VARCHAR100否LOGTIME操作时间DATETIME否IP操作IP地址VARCHAR50否IP地址表(IPADDRESS)字段名称描述数据类型字段长度可否为空IP1开始IPFLOAT否IP2结束IPFLOAT否COUNTRY国家VARCHAR20否CITY城市VARCHAR50否53程序代码531数据库连接DATABASECONNJAVAIMPORTJAVASQLCONNECTIONIMPORTJAVASQLSQLEXCEPTIONIMPORTJAVAXNAMINGCONTEXTIMPORTJAVAXNAMINGNAMINGEXCEPTIONIMPORTJAVAXNAMINGINITIALCONTEXTIMPORTJAVAXSQLDATASOURCEPUBLICCLASSDATABASECONNPUBLICSTATICSYNCHRONIZEDCONNECTIONGETCONNECTIONTHROWSEXCEPTIONTRYCONTEXTCTXNEWINITIALCONTEXTCONTEXTENVCTXCONTEXTCTXLOOKUP“JAVACOMP/ENV“/TOMCAT/JBOSSUSETHISMETHOD/DATASOURCEDSDATASOURCECTXLOOKUP“JAVA/LEE“RETURNDSGETCONNECTIONCATCHSQLEXCEPTIONETHROWECATCHNAMINGEXCEPTIONETHROWE532显示文章NEWSDATAJAVAIMPORTJAVASQLCONNECTIONIMPORTJAVASQLSTATEMENTIMPORTJAVASQLPREPAREDSTATEMENTIMPORTJAVASQLRESULTSETIMPORTJAVAUTILARRAYLISTIMPORTJAVAUTILCOLLECTIONIMPORTJAVAUTILITERATORIMPORTJAVAUTILDATEIMPORTJAVAUTILLOCALEIMPORTJAVATEXTDATEFORMATIMPORTCNEDUCUMTUTILDATABASECONNIMPORTCNEDUCUMTBEANCATEGORYDATAIMPORTCNEDUCUMTBEANCATEGORYPUBLICCLASSNEWSDATAPRIVATESTATICINTTOTALNEWS0PUBLICSTATICINTGETTOTALNEWSRETURNTOTALNEWS/GETNEWSICLEBYNEWSICLEIDPARAMIDINTPARAMDATASOURCEDATASOURCETHROWSEXCEPTIONRETURNNEWSICLE/PUBLICSTATICNEWSGETNEWSINTIDTHROWSEXCEPTIONDATEFORMATDATEFDATEFORMATGETDATEINSTANCEDATEFORMATFULL,LOCALECHINADATEFORMATTIMEFDATEFORMATGETTIMEINSTANCEDATEFORMATFULL,LOCALECHINACONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLRESULTSETRSNULLNEWSNEWSNEWNEWSTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“SELECTFROMNEWSWHEREID“PSTMTSETINT1,IDRSPSTMTEXECUTEQUERYIFRSNEXTNEWSSETIDRSGETINT“ID“NEWSSETCATEGORYRSGETINT“CATEGORY“NEWSSETTITLERSGETSTRING“TITLE“NEWSSETCONTENTRSGETSTRING“CONTENT“NEWSSETHITSRSGETINT“HITS“NEWSSETAUTHORRSGETSTRING“AUTHOR“NEWSSETADDTIMEDATEFFORMATRSGETTIMESTAMP“ADDTIME“TIMEFFORMATRSGETTIMESTAMP“ADDTIME“NEWSSETKEYWORDRSGETSTRING“KEYWORD“NEWSSETISRECOMMANDATIONRSGETBOOLEAN“ISRECOMMANDATION“NEWSSETEDITORRSGETSTRING“EDITOR“NEWSSETWRITEFROMRSGETSTRING“WRITEFROM“ELSETHROWNEWEXCEPTION“SORRYTHENEWSNOTFOUND“FINALLYIFRSNULLRSCLOSEIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSERETURNNEWS/GETNEWS1IFCATEGORY0THENGETALLCATEGORYNEWSICLESELSEGETTHENCATEGORYNEWSICLES2IFTOP0THENGETALLNEWSICLESELSEGETTOPNEWSICLEPARAMCATEGORYINTPARAMTOPINTPARAMDATASOURCEDATASOURCETHROWSEXCEPTIONRETURNARRAYLIST/PUBLICSTATICCOLLECTIONGETNEWSINTCATEGORY,INTTOPTHROWSEXCEPTION/DATEFORMATDATEFDATEFORMATGETDATEINSTANCEDATEFORMATFULL,LOCALECHINA/DATEFORMATTIMEFDATEFORMATGETTIMEINSTANCEDATEFORMATFULL,LOCALECHINA/间隔一周的为最新/LONGBETWEENTIME72460601000DATECURRENTDATENEWDATECOLLECTIONALLNEWSNEWARRAYLISTNEWSNEWSNULLCONNECTIONCONNNULLRESULTSETRSNULLSTATEMENTSTMTNULLSTRINGSQLNULLTRYCONNDATABASECONNGETCONNECTIONSTMTCONNCREATESTATEMENTIFCATEGORY0IFTOP0SQL“SELECTFROMNEWSORDERBYIDDESC“ELSESQL“SELECTFROMNEWSORDERBYIDDESCLIMIT0,“TOP“ELSEIFTOP0SQL“SELETCFROMNEWSWHERECATEGORY“CATEGORY“ORDERBYIDDESC“ELSESQL“SELECTFROMNEWSWHERECATEGORY“CATEGORY“ORDERBYIDDESCLIMIT0,“TOP“RSSTMTEXECUTEQUERYSQLWHILERSNEXTNEWSNEWNEWSNEWSSETIDRSGETINT“ID“NEWSSETCATEGORYRSGETINT“CATEGORY“NEWSSETTITLERSGETSTRING“TITLE“NEWSSETCONTENTRSGETSTRING“CONTENT“NEWSSETHITSRSGETINT“HITS“NEWSSETAUTHORRSGETSTRING“AUTHOR“/NEWSSETADDTIMEDATEFFORMATRSGETTIMESTAMP“ADDTIME“TIMEFFORMATRSGETTIMESTAMP“ADDTIME“NEWSSETADDTIMERSGETSTRING“ADDTIME“NEWSSETKEYWORDRSGETSTRING“KEYWORD“NEWSSETISRECOMMANDATIONRSGETBOOLEAN“ISRECOMMANDATION“NEWSSETEDITORRSGETSTRING“EDITOR“NEWSSETWRITEFROMRSGETSTRING“WRITEFROM“ALLNEWSADDNEWSFINALLYIFRSNULLRSCLOSEIFSTMTNULLSTMTCLOSEIFCONNNULLCONNCLOSERETURNALLNEWS/GETTHENEWSBYCATEGORYIFCATGEGORYEQUALSZEROTHENGETALLOFTHENEWSUSETHEPAGETOPAGEGETTHENEWSPARAMCATEGORYINTPARAMSTARTINTPARAMPERPAGEINTTHROWSEXCEPTIONRETURNCOLLECTION/PUBLICSTATICCOLLECTIONGETNEWSINTCATEGORY,INTSTART,INTPERPAGETHROWSEXCEPTIONDATEFORMATDATEFDATEFORMATGETDATEINSTANCEDATEFORMATFULL,LOCALECHINA/间隔一周的为最新/LONGBETWEENTIME72460601000DATECURRENTDATENEWDATECOLLECTIONALLNEWSNEWARRAYLISTCONNECTIONCONNNULLSTATEMENTSTMTNULLRESULTSETRSNULLNEWSNEWSNULLSTRINGSQL“IFPERPAGETOTALNEWSRETURNALLNEWSRSABSOLUTESTARTDONEWSNEWNEWSNEWSSETIDRSGETINT1NEWSSETCATEGORYRSGETINT2NEWSSETTITLERSGETSTRING3NEWSSETCONTENTRSGETSTRING4NEWSSETHITSRSGETINT5NEWSSETAUTHORRSGETSTRING6NEWSSETADDTIMEDATEFFORMATRSGETTIMESTAMP“ADDTIME“/NEWSSETADDTIMERSGETSTRING“ADDTIME“IFCURRENTDATEGETTIMERSGETTIMESTAMP“ADDTIME“GETTIME“NEWSSETKEYWORDRSGETSTRING8NEWSSETISRECOMMANDATIONRSGETBOOLEAN9NEWSSETEDITORRSGETSTRING10NEWSSETWRITEFROMRSGETSTRING11ALLNEWSADDNEWSWHILERSNEXTRSABSOLUTESTARTDONEWSNEWNEWSNEWSSETIDRSGETINT1NEWSSETCATEGORYRSGETINT2NEWSSETTITLERSGETSTRING3NEWSSETCONTENTRSGETSTRING4NEWSSETHITSRSGETINT5NEWSSETAUTHORRSGETSTRING6NEWSSETADDTIMERSGETSTRING“ADDTIME“NEWSSETKEYWORDRSGETSTRING8NEWSSETISRECOMMANDATIONRSGETBOOLEAN9NEWSSETEDITORRSGETSTRING10NEWSSETWRITEFROMRSGETSTRING11IFNEWSISRECOMMANDATIONALLNEWSADDNEWSWHILERSNEXTFINALLYIFRSNULLRSCLOSEIFSTMTNULLSTMTCLOSEIFCONNNULLCONNCLOSERETURNALLNEWS/ADDNEWSICLEPARAMNEWSNEWSICLEPARAMDATASOURCEDATASOURCETHROWSEXCEPTION/PUBLICSTATICVOIDADDNEWSNEWSNEWSTHROWSEXCEPTIONCONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“INSERTINTONEWSCATEGORY,TITLE,CONTENT,HITS,AUTHOR,ADDTIME,KEYWORD,ISRECOMMANDATION,EDITOR,WRITEFROMVALUES,NOW,“PSTMTSETINT1,NEWSGETCATEGORYPSTMTSETSTRING2,NEWSGETTITLEPSTMTSETSTRING3,NEWSGETCONTENTPSTMTSETINT4,NEWSGETHITSPSTMTSETSTRING5,NEWSGETAUTHOR/PSTMTSETDATE6,NEWJAVASQLDATENEWJAVAUTILDATEGETTIMEPSTMTSETSTRING6,NEWSGETKEYWORDPSTMTSETBOOLEAN7,NEWSISRECOMMANDATIONPSTMTSETSTRING8,NEWSGETEDITORPSTMTSETSTRING9,NEWSGETWRITEFROMPSTMTEXECUTEUPDATEFINALLYIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSE/DELETENEWSICLEBYIDPARAMIDINTPARAMDATASOURCEDATASOURCETHROWSEXCEPTION/PUBLICSTATICVOIDDELETENEWSINTIDTHROWSEXCEPTIONCONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“DELETEFROMNEWSWHEREID“PSTMTSETINT1,IDPSTMTEXECUTEUPDATEFINALLYIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSE/UPDATETHENEWSICLEPARAMNEWSNEWSICLEPARAMDATASOURCEDATASOURCETHROWSEXCEPTION/PUBLICSTATICVOIDUPDATENEWSNEWSNEWSTHROWSEXCEPTIONCONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“UPDATENEWSSETCATEGORY,TITLE,CONTENT,HITS,AUTHOR,KEYWORD,ISRECOMMANDATION,EDITOR,WRITEFROMWHEREID“PSTMTSETINT1,NEWSGETCATEGORYPSTMTSETSTRING2,NEWSGETTITLEPSTMTSETSTRING3,NEWSGETCONTENTPSTMTSETINT4,NEWSGETHITSPSTMTSETSTRING5,NEWSGETAUTHOR/PSTMTSETSTRING6,NEWSGETADDTIMEPSTMTSETSTRING6,NEWSGETKEYWORDPSTMTSETBOOLEAN7,NEWSISRECOMMANDATIONPSTMTSETSTRING8,NEWSGETEDITORPSTMTSETSTRING9,NEWSGETWRITEFROMPSTMTSETINT10,NEWSGETIDPSTMTEXECUTEUPDATEFINALLYIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSE/THISMETHODRETURNTHEMAXVALUEOFNEWSIDTHISCANKNOWTHEADDINGNEWSIDTHROWSEXCEPTIONRETURNINT/PUBLICSTATICINTGETMAXNEWSIDTHROWSEXCEPTIONINTMAX0CONNECTIONCONNNULLSTATEMENTSTMTNULLRESULTSETRSNULLTRYCONNDATABASECONNGETCONNECTIONSTMTCONNCREATESTATEMENTRSSTMTEXECUTEQUERY“SELECTMAXIDFROMNEWS“RSNEXTMAXRSGETINT1FINALLYIFRSNULLRSCLOSEIFSTMTNULLSTMTCLOSEIFCONNNULLCONNCLOSERETURNMAX/THISMETHODTOADDAHITSPARAMIDINTTHROWSEXCEPTION/PUBLICSTATICVOIDADDHITSINTIDTHROWSEXCEPTIONCONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“UPDATENEWSSETHITSHITS1WHEREID“PSTMTSETINT1,IDPSTMTEXECUTEUPDATEFINALLYIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSE/GETTHETOTALNEWSNUMBERRETURNINTTHROWSEXCEPTION/PUBLICSTATICINTGETTOTALNEWSNUMBERTHROWSEXCEPTIONINTNO0CONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLRESULTSETRSNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“SELECTCOUNTFROMNEWS“RSPSTMTEXECUTEQUERYRSNEXTNORSGETINT1FINALLYIFPSTMTNULLPSTMTCLOSEIFRSNULLRSCLOSEIFCONNNULLCONNCLOSERETURNNO533日志管理IMPORTJAVASQLRESULTSETIMPORTJAVASQLPREPAREDSTATEMENTIMPORTJAVAUTILCOLLECTIONIMPORTJAVAUTILARRAYLISTIMPORTJAVASQLCONNECTION/IMPORTJAVAUTILDATEIMPORTCNEDUCUMTUTILDATABASECONNPUBLICCLASSLOGDATA/THISMETHODLOGALOGPARAMLOGLOGTHROWSEXCEPTION/PUBLICSTATICVOIDADDLOGLOGLOGTHROWSEXCEPTIONCONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULL/DATENOWNEWDATE/RESULTSETRSNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“INSERTINTOLOGSUSERNAME,EVENT,LOGTIME,IPVALUES,NOW,“PSTMTSETSTRING1,LOGGETUSERNAMEPSTMTSETSTRING2,LOGGETEVENT/PSTMTSETDATE3,NEWJAVASQLDATENEWJAVAUTILDATEGETTIME/PSTMTSETSTRING3,NOWTOSTRINGPSTMTSETSTRING3,LOGGETIPPSTMTEXECUTEUPDATEFINALLYIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSE/THISMETHODRETURNALLOFTHELOGSTHROWSEXCEPTIONRETURNCOLLECTION/PUBLICSTATICCOLLECTIONGETLOGSTHROWSEXCEPTIONCOLLECTIONLOGSNEWARRAYLISTLOGLOGNULLCONNECTIONCONNNULLPREPAREDSTATEMENTPSTMTNULLRESULTSETRSNULLTRYCONNDATABASECONNGETCONNECTIONPSTMTCONNPREPARESTATEMENT“SELECTFROMLOGS“RSPSTMTEXECUTEQUERYWHILERSNEXTLOGNEWLOGLOGSETIDRSGETINT1LOGSETUSERNAMERSGETSTRING2LOGSETEVENTRSGETSTRING3LOGSETLOGTIMERSGETSTRING4LOGSETIPRSGETSTRING5LOGSADDLOGFINALLYIFRSNULLRSCLOSEIFPSTMTNULLPSTMTCLOSEIFCONNNULLCONNCLOSERETURNLOGS534EMAIL自动回复SENDMAILJAVAIMPORTJAVAUTILPROPERTIESIMPORTJAVAUTILDATEIMPORTJAVAUTILARRAYLISTIMPORTJAVAXMAILIMPORTJAVAXMAILINTERNETIMPORTJAVAXACTIVATIONPUBLICABSTRACTCLASSSENDMAILPROTECTEDBODYPARTMESSAGEBODYPARTNULLPROTECTEDMULTIPARTMULTIPARTNULLPROTECTEDMIMEMESSAGEMAILMESSAGENULLPROTECTEDSESSIONMAILSESSIONNULLPROTECTEDPROPERTIESMAILPROPERTIESSYSTEMGETPROPERTIESPROTECTEDINTERNETADDRESSMAILFROMADDRESSNULLPROTECTEDINTERNETADDRESSMAILTOADDRESSNULLPROTECTEDMAILAUTHENTICATORAUTHENTICATORNULLPROTECTEDSTRINGMAILSUBJECT“PROTECTEDDATEMAILSENDDATENULLPUBLICSENDMAILSTRINGSMTPHOST,STRINGUSERNAME,STRINGPASSWORDMAILPROPERTIESPUT“MAILSMTPHOST“,SMTPHOSTMAILPROPERTIESPUT“MAILSMTPAUTH“,“TRUE“/设置SMTP认证,很关键的一句AUTHENTICATORNEWMAILAUTHENTICATORUSERNAME,PASSWORDMAILSESSIONSESSIONGETDEFAULTINSTANCEMAILPROPERTIES,AUTHENTICATORMAILMESSAGENEWMIMEMESSAGEMAILSESSIONMESSAGEBODYPARTNEWMIMEBODYPART/设置邮件主题PUBLICVOIDSETSUBJECTSTRINGMAILSUBJECTTHROWSMESSAGINGEXCEPTIONTHISMAILSUBJECTMAILSUBJECTMAILMESSAGESETSUBJECTMAILSUBJECT/所有子类都需要实现的抽象方法,为了支持不同的邮件类型PROTECTEDABSTRACTVOIDSETMAILCONTENTSTRINGMAILCONTENTTHROWSMESSAGINGEXCEPTION/设置邮件发送日期PUBLICVOIDSETSENDDATEDATESENDDATETHROWSMESSAGINGEXCEPTIONTHISMAILSENDDATESENDDATEMAILMESSAGESETSENTDATESENDDATE/设置邮件发送附件PUBLICVOIDSETATTACHMENTSSTRINGATTACHMENTNAMETHROWSMESSAGINGEXCEPTIONMESSAGEBODYPARTNEWMIMEBODYPARTDATASOURCESOURCENEWFILEDATASOURCEATTACHMENTNAMEMESSAGEBODYPARTSETDATAHANDLERNEWDATAHANDLERSOURCEINTINDEXATTACHMENTNAMELASTINDEXOFSTRINGATTACHMENTREALNAMEATTACHMENTNAMESUBSTRINGINDEX1MESSAGEBODYPARTSETFILENAMEATTACHMENTREALNAMEMULTIPARTADDBODYPARTMESSAGEBODYPART/设置发件人地址PUBLICVOIDSETMAILFROMSTRINGMAILFROMTHROWSMESSAGINGEXCEPTIONMAILFROMADDRESSNEWINTERNETADDRESSMAILFROMMAILMESSAGESETFROMMAILFROMADDRESS/设置收件人地址,收件人类型为TO,CC,BCC大小写不限PUBLICVOIDSETMAILTOSTRINGMAILTO,STRINGMAILTYPETHROWSEXCEPTIONFORINTI0IMAILTOLENGTHIMAILTOADDRESSNEWINTERNETADDRESSMAILTOIIFMAILTYPEEQUALSIGNORECASE“TO“MAILMESSAGEADDRECIPIENTMESSAGERECIPIENTTYPETO,MAILTOADDRESSELSEIFMAILTYPEEQUALSIGNORECASE“CC“MAILMESSAGEADDRECIPIENTMESSAGERECIPIENTTYPECC,MAILTOADDRESSELSEIFMAILTYPEEQUALSIGNORECASE“BCC“MAILMESSAGEADDRECIPIENTMESSAGERECIPIENTTYPEBCC,MAILTOADDRESSELSETHROWNEWEXCEPTION“UNKNOWNMAILTYPE“MAILTYPE“/开始投递邮件PUBLICVOIDSENDMAILTHROWSMESSAGINGEXCEPTION,SENDFAILEDEXCEPTIONIFMAILTOADDRESSNULLSYSTEMOUTPRINTLN“请你必须你填写收件人地址“SYSTEMEXIT1ELSEMAILMESSAGESETCONTENTMULTIPARTSYSTEMOUTPRINTLN“正在发送邮件,请稍候“TRANSPORTSENDMAILMESSAGESYSTEMOUTPRINTLN“恭喜你,邮件已经成功发送“535验证码IMPORTCOMSUNIMAGECODECJPEGJPEGCODECIMPORTCOMSUNIMAGECODECJPEGJPEGIMAGEENCODERIMPORTORGAPACHECOMMONSLANGRANDOMSTRINGUTILSIMPORTORGAPACHECOMMONSLOGGINGLOGIMPORTORGAPACHECOMMONSLOGGINGLOGFACTORYIMPORTJAVAAWTCOLORIMPORTJAVAAWTFONTIMPORTJAVAAWTGRAPHICS2DIMPORTJAVAAWTRECTANGLEIMPORTJAVAAWTIMAGEBUFFEREDIMAGEIMPORTJAVAIOIOEXCEPTIONIMPORTJAVAXSERVLETSERVLETEXCEPTIONIMPORTJAVAXSERVLETHTTPHTTPSERVLETIMPORTJAVAXSERVLETHTTPHTTPSERVLETREQUESTIMPORTJAVAXSERVLETHTTPHTTPSERVLETRESPONSEPUBLICCLASSVERIFYCODEEXTENDSHTTPSERVLET/STATICFIELDS/INITIALIZERS/LOG/PRIVATESTATICLOGLOGLOGFACTORYGETLOGVERIFYCODECLASS/CONSTRUCTORS/DEFAULTCONTRUCTOR/PUBLICVERIFYCODE/METHODS/SERVICEPARAMREQUESTAAPARAMRESPONSEAAEXCEPTIONIOEXCEPTIONIOEXCEPTIONEXCEPTIONSERVLETEXCEPTIONEXCEPTIO
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年教师节发言致辞例文(6篇)
- 庆祝五四青年节活动策划方案例文(4篇)
- DB52T 1281-2018 精准扶贫 建档立卡贫困人口生态护林员管理规范
- 文明城市干部职工诚信考核评价制度模版(2篇)
- 2024年安全专题会议讲稿样本(5篇)
- 食品安全应急预案制度例文(4篇)
- 2024年企业财务部门年终工作总结范例(3篇)
- 二中仓库管理制度范文(2篇)
- 物联网定位技术的应用
- 无人机技术前沿与挑战考核试卷
- 滚动计划法课件完整版
- 国电南自ps6000监控技术说明书
- 光电子技术课件第四章 光探测(下)
- 中国四大民间故事(完整版)资料
- 木屋工程施工组织设计(完整版)资料
- 人教版语文八年级上册( 部编版)24 《周亚夫军细柳》课件
- 专业技术职务聘任表(2017年版)
- ISO20000认证-ISO20000差距分析报告
- GB/T 42195-2022老年人能力评估规范
- 第三章 信息系统的网络组建- 复习课件 2021-2022学年粤教版(2019)高中信息技术必修2
- GB/T 4909.4-2009裸电线试验方法第4部分:扭转试验
评论
0/150
提交评论