资源描述:
《翻译文献-第章 使用自定义标签库和jsp标准标签库》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、大连交通大学2016届本科生毕业设计(论文)外文翻译外文原文Chapter7.UsingCustomTagLibrariesandtheJSPStandardTagLibrarySofarwe'vecoveredtheJSPbasics—theprimarypartsofapageandinstallationandexecutionofapage—andhowtousebeanstodynamicallyaddcontenttoapage.Beforewestartworkingonrealapplications,le
2、t'sturntoanotherfundamentalJSPfeature:customtaglibraries.Customtaglibrariesare,inmyopinion,whatmakeJSPsopowerful.Theymakeitpossibleforpageauthorstoembedprettymuchanylogicinapageusingfamiliar,HTML-likeelements.Inthischapter,wetakeacloselookatwhatacustomtaglibraryis
3、,howtoinstallanduseit,andwhattheJSPStandardTagLibrary(JSTL)bringstothetable.7.1WhatIsaCustomTagLibrary?TheJSPstandardactions,suchastheandactionsusedinChapter6,areHTML-likeelementsforcommonlyneededfunctionsinaJSPpage:creatingbeans,acce
4、ssingbeanproperties,andinvokingotherJSPpages.Butthere'salotmoreyouwanttodothatisn'tcoveredbythestandardactions.Toextendthesetofactionelementsapageauthorcanuseinthesamefamiliarway,newactionscanbedeveloped,eitherbyaprogrammerasJavaclassesorbyapageauthorastagfiles(as
5、pecialkindofJSPfile).Ineithercase,theseactionsarecalledcustomactions.Acustomactioncandoprettymuchanything:ithasaccesstoallinformationabouttherequest,itcanaddcontenttotheresponsebodyaswellassetresponseheaders,anditcanuseanyJavaAPItoaccessexternalresourcessuchasdata
6、bases,LDAPservers,ormailservers.ThewaytheJSPcontainerinteractswithacustomactionalsomakesitpossibleforacustomactiontoconditionallyprocessitsbodyandtoaborttheprocessingoftherestofthepage.Customactionscanbecreatedforapplication-specificfunctionstomakeiteasierforpagea
7、uthorstodeveloptheJSPpages.Sometypicalexamplesareshownlaterinthisbook.大连交通大学2016届本科生毕业设计(论文)外文翻译AcustomactionisinsertedintoapageusinganHTML-like(actuallyXML)element.Theattributevalues,andsometimesthebody,youprovidetelltheactionwhattodoandthedatatouse.Infact,youhav
8、ealreadyusedacustomaction;theactionusedinChapter5andChapter6.It'spartoftheJSTLcorelibrary,andtheJSTLlibrariesareimplementedbasedonthesamemechanis