欢迎来到天天文库
浏览记录
ID:5928123
大小:52.21 KB
页数:11页
时间:2017-12-28
《Jsp最佳实践外文翻译@中英文翻译@外文文献翻译》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、沈阳航空工业学院毕业设计(论文)JSPbestpracticesJavaServerPages(JSPs)technologyisanextensionofJavaservlettechnologyandcombinesHTMLandJavacodeintoasinglefile.WhileJavaservlettechnologyfocusesonJavaclassescapableofgeneratingHTMLoutputwithPrintWriter.println()statements,JSPtechnologyabstractsthisc
2、oncepttoahigherlevel.WithJavaServerPages,aWebdevelopercanwritestaticHTMLpagesandsimplyaddJavacodeinthosesectionsofthepagethatneedtobedynamicallygenerated.WhilethisflexibilityenablesrapiddevelopmentofsimpleWebapplications,itcanbeabused,resultinginunnecessarilycomplexapplicationst
3、hataredifficulttomaintain,reuse,andenhance.Toavoidneedlesslycomplexapplications,followthepracticesIpresentinthisarticle:1.SeparateHTMLfromJava2.PlacebusinesslogicinJavaBeans3.Factorgeneralbehavioroutofcustomtaghandlerclasses4.FavorHTMLinJavahandlerclassesoverJavainJSPs5.Useanapp
4、ropriateinclusionmechanism6.UseaJSPtemplatemechanism7.Usestylesheets8.UsetheMVCpattern9.Useavailablecustomtaglibraries10.UseJSPcommentsinmostcases11.FollowHTMLbestpractices12.UtilizetheJSPexceptionmechanismThesetipswillhelpyouwriteJSPsthatarereusableandeasytomaintain.(1)Separate
5、HTMLfromJavaItcanbetemptingtothrowallJavaandHTMLcodenecessaryforaWebpageintoasingleJSPfile.Insimplesystemdevelopment,suchanapproachmakesiteasyforsomeonenewtothesystemtolocateallrelevantcodeinoneplaceandunderstandhowit11沈阳航空工业学院毕业设计(论文)allinteracts.However,thisapproachbecomesburd
6、ensomeandcostlywhentheapplicationgrowsmorecomplexandmoredevelopersbecomeinvolved.CombiningHTMLandJavainthesamesourcecodecanmakethecodesignificantlylessreadable.Toenhancesoftwarereadability,developersoftenuseindentation;butmixingHTMLandJavascriptletsinthesamefilecanmakeusefulinde
7、ntationextremelydifficulttomaintain.ManyWebdevelopmentmethodologiesandarchitecturesnowemphasizetheseparationofHTMLfromJavacodesodifferentdeveloperscanfocusontheirstrengths.ProperlyseparatingJavaandHTML,includingHTML-likeJSPtagsandcustomtags,allowsWebdesignersandHTMLcoderstoworko
8、ntheHTML(presentation)aspects,whileJavadevelope
此文档下载收益归作者所有