資源描述:
《翻譯文獻-第章 使用自定義標簽庫和jsp標準標簽庫》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、大連交通大學2016屆本科生畢業(yè)設計(論文)外文翻譯外文原文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屆本科生畢業(yè)設計(論文)外文翻譯AcustomactionisinsertedintoapageusinganHTML-like(actuallyXML)element.Theattributevalues,andsometimesthebody,youprovidetelltheactionwhattodoandthedatatouse.Infact,youhav
8、ealreadyusedacustomaction;theactionusedinChapter5andChapter6.It'spartoftheJSTLcorelibrary,andtheJSTLlibrariesareimplementedbasedonthesamemechanis