Head First Servlets and JSP phần 7 pptx

74 368 0
Head First Servlets and JSP phần 7 pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

 FKDSWHU ?Q\P$K"QUXWZ\&\PMZMIZMVW_<0:  _Ia[\WQVKT]LMKWV\MV\ 3OFARWEVEUSEDTWODIFFERENTWAYSTOADDCONTENTFROMANOTHER RESOURCEINTOA*30"UTTHERESYETANOTHERWAYUSING*34, 7KHLQFOXGH GLUHFWLYH #LQFOXGH¿OH ´+HDGHUKWPO´!  7KHMVSLQFOXGH! VWDQGDUGDFWLRQ MVSLQFOXGHSDJH ´+HDGHUMVS´!  7KHFLPSRUW!-67/WDJ FLPSRUWXUO ´KWWSZZZZLFNHGO\VPDUWFRPVN\OHUKRUVHKWPO´!  3TATICADDSTHECONTENTFROMTHEVALUEOFTHElLE ATTRIBUTETOTHECURRENTPAGEATTRANSLATIONTIME $YNAMICADDSTHECONTENTFROMTHEVALUEOFTHE PAGEATTRIBUTETOTHECURRENTPAGEATREQUESTTIME $YNAMICADDSTHECONTENTFROMTHEVALUEOFTHE 52,ATTRIBUTETOTHECURRENTPAGEATREQUESTTIME )TWORKSALOTLIKEJSPINCLUDEBUTITSMORE POWERFULANDmEXIBLE Unlike the other two includes, the <c:import> url can be from outside the web Container!  (DFKRIWKHWKUHHPHFKDQLVPVIRULQFOXGLQJFRQWHQWIURPDQRWKHUUHVRXUFHLQWR\RXU-63XVHVD GLIIHUHQWZRUGIRUWKHDWWULEXWH7KHLQFOXGHGLUHFWLYHXVHV¿OHWKHMVSLQFOXGH!XVHVSDJHDQG WKH-67/FLPSRUW!WDJXVHVXUO7KLVPDNHVVHQVHZKHQ\RXWKLQNDERXWLWEXW\RXGRKDYH WRPHPRUL]HDOOWKUHH7KHGLUHFWLYHZDVRULJLQDOO\LQWHQGHGIRUVWDWLFOD\RXWWHPSODWHVOLNH+70/ KHDGHUV,QRWKHUZRUGVD³¿OH´7KHMVSLQFOXGH!ZDVLQWHQGHGPRUHIRUG\QDPLFFRQWHQW FRPLQJIURP-63VVRWKH\QDPHGWKHDWWULEXWH³SDJH´WRUHÀHFWWKDW7KHDWWULEXWHIRUFLPSRUW! LVQDPHGIRUH[DFWO\ZKDW\RXJLYHLW²D85/5HPHPEHUWKH¿UVWWZR³LQFOXGHV´FDQ¶WJRRXWVLGH WKHFXUUHQW&RQWDLQHUEXWFLPSRUW!FDQ 7KH\DOOKDYHGLIIHUHQWDWWULEXWHQDPHV $QGZDWFKRXWIRU´LQFOXGHµYV´LPSRUWµ Do NOT confuse <c:import> (a type of include) with the ÒimportÓ attribute of the page directive (a way to put a Java import statement in the generated servlet). WKHFLPSRUW!WDJ Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited. XVLQJ-67/ \RXDUHKHUH  $K"QUXWZ\&KIVZMIKP7=<;1,-\PM_MJIXX 7ITHJSPINCLUDEORTHEINCLUDEDIRECTIVEYOUCANINCLUDEONLYPAGESTHATAREPARTOFTHE CURRENTWEBAPP"UTNOWWITHCIMPORTYOUHAVETHEOPTIONTOPULLINCONTENTFROM OUTSIDETHE#ONTAINER4HISSIMPLEEXAMPLESHOWSA*30ON3ERVER!IMPORTINGTHECONTENTS OFA52,ON3ERVER"!TREQUESTTIMETHE(4-,CHUNKINTHEIMPORTEDlLEISADDEDTO THE*304HEIMPORTEDCHUNKUSESAREFERENCETOANIMAGETHATISALSOON3ERVER" #WDJOLESUH¿[ ´F´XUL ´KWWSMDYDVXQFRPMVSMVWOFRUH´! KWPO!ERG\! FLPSRUWXUO ´KWWSZZZZLFNHGO\VPDUWFRPVN\OHUKRUVHKWPO´! EU! 7KLVLVP\KRUVH ERG\!KWPO! 7KH-63 LPJVUF ´KWWSZZZZLFNHGO\VPDUWFRPVN\OHUKRUVHJLI´! 7KHLPSRUWHGÀOH % $ 6HUYHU$WKH-63GRLQJWKHLPSRUW 6HUYHU%WKHLPSRUWHGFRQWHQW KWWSORFDOKRVWWHVW-637HVWHUGR 7KLVLVP\KRUVH 7KHUHVSRQVH The horse is coming from a completely different web server than the page that contains the text. Òhorse.htmlÓ and Òhorse.gifÓ are both on Server B, a completely different web server from the one with the JSP. (DonÕt forget: as with other include mechanisms, the thing you import should be an HTML fragment and NOT a complete page with opening and closing <html><body> tags.) Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited.  FKDSWHU +][\WUQbQVO\PM\PQVOaW]QVKT]LM 2EMEMBERINTHEPREVIOUSCHAPTERWHENWEDIDAJSPINCLUDETO PUTINTHELAYOUTHEADERAGRAPHICWITHSOMETEXTBUTWEWANTED TOCUSTOMIZETHESUBTITLEUSEDINTHEHEADER7EUSEDJSPPARAMTO MAKETHATHAPPEN 7KH-63ZLWKWKHMVSLQFOXGH! KWPO!ERG\! MVSLQFOXGHSDJH ´+HDGHUMVS´!  MVSSDUDPQDPH ´VXE7LWOH´YDOXH ´:HWDNHWKHVWLQJRXWRI62$3´! MVSLQFOXGH! EU! HP!:HOFRPHWRRXU:HE6HUYLFHV6XSSRUW*URXSHP!EU!EU! &RQWDFWXVDW^LQLW3DUDPPDLQ(PDLO` ERG\!KWPO :HWDNHWKHVWLQJRXWRI62$3 KWWSORFDOKRVWWHVWV&RQWDFWMVS :HOFRPHWRRXU:HE6HUYLFHV6XSSRUW*URXS &RQWDFWXVDWOLNHZHFDUH#ZLFNHGO\VPDUWFRP   LPJVUF ´LPDJHV:HE6HUYLFHVMSJ´!EU! HP!VWURQJ! ^SDUDPVXE7LWOH`VWURQJ!HP! EU!  7KHLQFOXGHGÀOH´+HDGHUMVSµ  ( YL We made the subtitle ÒWe take the sting Ó available to the header JSP by setting it as a new request parameter. WKHFLPSRUW!WDJ Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited. XVLQJ-67/ \RXDUHKHUH  ,WQVO\PM[IUM\PQVO_Q\P$K"XIZIU& (EREWEACCOMPLISHTHESAMETHINGWEDIDONTHEPREVIOUSPAGEBUT USINGACOMBINATIONOFCIMPORTANDCPARAM9OULLSEETHATTHE STRUCTUREISVIRTUALLYIDENTICALTOTHEONEWEUSEDWITHSTANDARDACTIONS 7KH-63ZLWKWKHMVSLQFOXGH! #WDJOLESUH¿[ ´F´XUL ´KWWSMDYDVXQFRPMVSMVWOFRUH´! KWPO!ERG\! FLPSRUWXUO ´+HDGHUMVS´!  FSDUDPQDPH ´VXE7LWOH´YDOXH ´:HWDNHWKHVWLQJRXWRI62$3´! FLPSRUW! EU! HP!:HOFRPHWRRXU:HE6HUYLFHV6XSSRUW*URXSHP!EU!EU! &RQWDFWXVDW^LQLW3DUDPPDLQ(PDLO` ERG\!KWPO! LPJVUF ´LPDJHV:HE6HUYLFHVMSJ´!EU! HP!VWURQJ! ^SDUDPVXE7LWOH`VWURQJ!HP! EU!  7KHLQFOXGHGÀOH´+HDGHUMVSµ  FH LQ F This page doesnÕt change at all. It doesnÕt care HOW the parameter got there, as long as itÕs there. No slash, because NOW the tag has a body Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited.  FKDSWHU 6RUU\WRFKDQJHWKHVXEMHFW KHUHEXW,MXVWQRWLFHG D+8*(SUREOHPZLWK-63V +RZFDQ\RXJXDUDQWHHVHVVLRQ WUDFNLQJIURPD-63ZLWKRXW XVLQJVFULSWLQJ" 6HVVLRQWUDFNLQJ KDSSHQVDXWRPDWLFDOO\ZLWK -63VXQOHVV\RXH[SOLFLWO\GLVDEOH LWZLWKDSDJHGLUHFWLYHWKDWKDV DVHVVLRQDWWULEXWHWKDWVD\V VHVVLRQ µIDOVHµ +HPLVVHGWKHSRLQW,VDLG ´JXDUDQWHHµ0\UHDOTXHVWLRQLVLI WKHFOLHQWGRHVQ·WVXSSRUWFRRNLHVKRZ FDQ,JHW85/UHZULWLQJWRKDSSHQ"+RZ FDQ,JHWWKHVHVVLRQ,'DGGHGWR WKH85/VLQP\-63" $KKKKHREYLRXVO\ GRHVQ·WNQRZDERXWWKH FXUO!WDJ,WGRHV85/ UHZULWLQJDXWRPDWLFDOO\ 85/UHZULWLQJLQD-63 Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited. XVLQJ-67/ \RXDUHKHUH  $K"]ZT&NWZITTaW]ZPaXMZTQVSVMML[ 2EMEMBERWAYBACKINOUROLDSERVLETDAYSWHENWEWANTEDTOUSEASESSION&IRST WEHADTOGETTHESESSIONEITHERTHEEXISTINGONEORANEWONE!TTHATPOINTTHE #ONTAINERKNOWSTHATITSSUPPOSEDTOASSOCIATETHECLIENTFROMTHISREQUESTWITHA PARTICULARSESSION)$4HE#ONTAINERWANTSTOUSEACOOKIEITWANTSTOINCLUDEA UNIQUECOOKIEWITHTHERESPONSEANDTHENTHECLIENTWILLSENDTHATCOOKIEBACKWITH EACHSUBSEQUENTREQUEST%XCEPTONEPROBLEMTHECLIENTMIGHTHAVEABROWSERWITH COOKIESDISABLED4HENWHAT 4HE#ONTAINERWILLAUTOMATICALLYFALLBACKTO52,REWRITINGIFITDOESNTGETACOOKIE FROMTHECLIENT"UTWITHSERVLETSYOU34),,HAVETOENCODEYOUR52,S)NOTHER WORDSYOUSTILLHAVETOTELLTHE#ONTAINERTOhAPPENDTHEJSESSIONIDTOTHEENDOFTHIS PARTICULAR52,vFOREACH52,WHEREITMATTERS7ELLYOUCANDOTHESAMETHING FROMA*30USINGTHECURLTAG 85/UHZULWLQJIURPDVHUYOHW SXEOLFYRLGGR*HW+WWS6HUYOHW5HTXHVWUHTXHVW+WWS6HUYOHW5HVSRQVHUHVSRQVH WKURZV,2([FHSWLRQ6HUYOHW([FHSWLRQ^ UHVSRQVHVHW&RQWHQW7\SH³WH[WKWPO´ 3ULQW:ULWHURXW UHVSRQVHJHW:ULWHU +WWS6HVVLRQVHVVLRQ UHTXHVWJHW6HVVLRQ RXWSULQWOQ³KWPO!ERG\!´ RXWSULQWOQ³DKUHI ?´´ UHVSRQVHHQFRGH85/³%HHU7HVWGR´³?´!FOLFND!´ RXWSULQWOQ³ERG\!KWPO!´ ` Add the extra session ID info to this URL. 85/UHZULWLQJIURPD-63 #WDJOLESUH¿[ ´F´XUL ´KWWSMDYDVXQFRPMVSMVWOFRUH´! KWPO!ERG\! 7KLVLVDK\SHUOLQNZLWK85/UHZULWLQJHQDEOHG DKUHI ´ FXUOYDOXH ¶LQSXW&RPPHQWVMVS¶!´!&OLFNKHUHD! ERG\!KWPO! This adds the jsessionid to the end of the ÒvalueÓ relative URL (if cookies are disabled). Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited.  FKDSWHU ?PI\QN\PM=:4VMML[MVKWLQVO' 2EMEMBERTHATINAN(440'%4REQUESTTHEPARAMETERSAREAPPENDEDTOTHE52,ASAQUERYSTRING &OREXAMPLEIFAFORMONAN(4-,PAGEHASTWOTEXTlELDSlRSTNAMEANDLASTNAMETHEREQUEST 52,WILLSTICKTHEPARAMETERNAMESANDVALUESONTOTHEENDOFTHEREQUEST52,"UTAN(440 REQUESTWONTWORKCORRECTLYIFITCONTAINSUNSAFECHARACTERSALTHOUGHMOSTMODERNBROWSERSWILLTRY TOCOMPENSATEFORTHIS )FYOUREAWEBDEVELOPERTHISISOLDNEWSBUTIFYOURENEWTOWEBDEVELOPMENTYOUNEEDTOKNOW THAT52,SOFTENNEEDTOBEENCODED52,ENCODINGMEANSREPLACINGTHEUNSAFERESERVEDCHARACTERS WITHOTHERCHARACTERSANDTHENTHEWHOLETHINGISDECODEDAGAINONTHESERVERSIDE&OREXAMPLE SPACESARENTALLOWEDINA52,BUTYOUCANSUBSTITUTEAPLUSSIGNhvFORTHESPACE4HEPROBLEMIS CURLDOES./4AUTOMATICALLYENCODEYOUR52,S 8VLQJFXUO!ZLWKDTXHU\VWULQJ FVHWYDU ´ODVW´YDOXH ´+LGGHQ&XUVRU´! FVHWYDU ´¿UVW´YDOXH ´&URXFKLQJ3L[HOV´! FXUOYDOXH ´LQSXW&RPPHQWVMVS"¿UVW ^¿UVW`ODVW ^ODVW`´YDU ´LQSXW85/´! 7KH85/XVLQJSDUDPVLV^LQSXW85/`EU! 2EMEMBERTHECURLTAGDOES52,REWRITINGBUTNOT52,ENCODING KWWSORFDOKRVWWHVWVULVN\MVS 7KH85/XVLQJSDUDPVLVP\$SSLQSXW&RPPHQWV MVS"ÀUVW &URXFKLQJ3L[HOVODVW +LGGHQ&XUVRU Uh-oh youÕre not supposed to have spaces in a URL! Yikes! Query string parameters have to be encoded spaces, for example, must be replaced with a plus Ò+Ó sign. Use the optional ÒvarÓ attribute when you want access to this value later 8VLQJFSDUDP!LQWKHERG\RIFXUO! 4HISSOLVESOURPROBLEM.OWWEGETBOTH52,REWRITINGAND52,ENCODING FXUOYDOXH ´LQSXW&RPPHQWVMVS´YDU ´LQSXW85/´!  FSDUDPQDPH ´¿UVW1DPH´YDOXH ´^¿UVW`´! FSDUDPQDPH ´ODVW1DPH´YDOXH ´^ODVW`´! FXUO! no slash .OWTHE52,LOOKSLIKETHIS P\$SSLQSXW&RPPHQWVMVS"¿UVW1DPH &URXFKLQJ3L[HOVODVW1DPH +LGGHQ&XUVRU Now weÕre safe, because <c:param> takes care of the encoding! WKHF85/!WDJ Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited. XVLQJ-67/ \RXDUHKHUH  AW]LW67<_IV\aW]ZKTQMV\[\W[MM\PQ[" ,·PLQWHUUXSWLQJWKLV-67/ WDONIRUDIHZPRPHQWVWR WDONDERXW\RXUHUURUKDQGOLQJ :H·UHDERXWWRGRVRPHWKLQJWKDW PLJKWFDXVHDQH[FHSWLRQ Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited.  FKDSWHU 5ISMaW]ZW_VMZZWZXIOM[ 4HEGUYSURlNGYOURSITEDOESNTWANTTOSEEYOURSTACKTRACE!NDHESNOTTOO THRILLEDTOGETASTANDARDh.OT&OUNDvEITHER 9OUCANTPREVENTALLERRORSOFCOURSEBUTYOUCANATLEASTGIVETHEUSERAFRIENDLIER ANDMOREATTRACTIVEERRORRESPONSEPAGE9OUCANDESIGNACUSTOMPAGETOHANDLE ERRORSTHENUSETHEPAGEDIRECTIVETOCONlGUREIT 7KHGHVLJQDWHG(5525SDJH´HUURU3DJHMVSµ #SDJH LV(UURU3DJH ´WUXH´! KWPO!ERG\! VWURQJ!%XPPHUVWURQJ! LPJVUF ´LPDJHVEXPPHU*X\MSJ´! ERG\!KWPO! 7KH%$'SDJHWKDWWKURZVDQH[FHSWLRQ´EDG3DJHMVSµ #SDJH HUURU3DJH ´HUURU3DJHMVS´! KWPO!ERG\! $ERXWWREHEDG LQW[ ! ERG\!KWPO! :KDWKDSSHQVZKHQ\RXUHTXHVW´EDG3DJHMVSµ %XPPHU KWWSORFDOKRVWWHVWVEDG3DJHMVS ConÞ rms for the Container, ÒYes, this IS an ofÞ cially-designated error page.Ó Tells the Container, ÒIf something goes wrong here, forward the request to errorPage.jspÓ. The REQUEST was for ÒbadPage.jspÓ, but that page threw an exception, so the RESPONSE came from ÒerrorPage.jspÓ. HUURUSDJHV Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited. XVLQJ-67/ \RXDUHKHUH  ;PMLWM[V¼\SVW_IJW]\\PM$MZZWZXIOM&,,\IO 9OUCANDECLAREERRORPAGESINTHE$$FORTHEENTIREWEBAPPANDYOU CANEVENCONlGUREDIFFERENTERRORPAGESFORDIFFERENTEXCEPTIONTYPESOR (440ERRORCODETYPESETC 4HE#ONTAINERUSESERRORPAGECONlGURATIONINTHE$$ASTHE DEFAULTBUTIFA*30HASANEXPLICITERROR0AGEPAGEDIRECTIVETHE #ONTAINERUSESTHEDIRECTIVE ,WZLOOWDNHPH)25(9(5WRSXW SDJHGLUHFWLYHVLQDOOP\-63VWR VSHFLI\WKHHUURUSDJHWRXVH$QG ZKDWLI,ZDQWDGLIIHUHQWHUURUSDJH GHSHQGLQJRQWKHHUURU",IRQO\WKHUH ZHUHDZD\WRFRQÀJXUHHUURUSDJHV IRUWKHZKROHZHEDSS Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 0596005407 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 747221 Copyright 2007, Safari Books Online, LLC. This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that otherwise violates the Safari Terms of Service is strictly prohibited. [...]...Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 74 7221 Copyright 20 07, Safari Books Online, LLC This PDF is exclusively for your use in accordance with the... permission for reprints and excerpts from the publisher Redistribution or other use that violates the fair use priviledge under U.S copyright laws (see 17 USC1 07) or that otherwise violates the Safari Terms of Service is strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly... strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 74 7221 Copyright 20 07, Safari Books Online, LLC This PDF is exclusively for your use in accordance with the... permission for reprints and excerpts from the publisher Redistribution or other use that violates the fair use priviledge under U.S copyright laws (see 17 USC1 07) or that otherwise violates the Safari Terms of Service is strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly... strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 74 7221 Copyright 20 07, Safari Books Online, LLC This PDF is exclusively for your use in accordance with the... permission for reprints and excerpts from the publisher Redistribution or other use that violates the fair use priviledge under U.S copyright laws (see 17 USC1 07) or that otherwise violates the Safari Terms of Service is strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly... strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 74 7221 Copyright 20 07, Safari Books Online, LLC This PDF is exclusively for your use in accordance with the... permission for reprints and excerpts from the publisher Redistribution or other use that violates the fair use priviledge under U.S copyright laws (see 17 USC1 07) or that otherwise violates the Safari Terms of Service is strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly... strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly Prepared for Stephen Goss, Safari ID: stephengoss@gmx.net Print Publication Date: 8/1/2004 User number: 74 7221 Copyright 20 07, Safari Books Online, LLC This PDF is exclusively for your use in accordance with the... permission for reprints and excerpts from the publisher Redistribution or other use that violates the fair use priviledge under U.S copyright laws (see 17 USC1 07) or that otherwise violates the Safari Terms of Service is strictly prohibited Chapter 9 Custom tags are powerful Chapter 9 Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher: O'Reilly . prohibited.  FKDSWHU =[QVOIIOTQJZIZaPI¼[ 67& lt;NZWUPM2;<4 #REATINGTHECODETHATGOESBEHINDATAGINOTHERWORDSTHE*AVACODE THATSINVOKEDWHENYOUPUTTHETAGINYOUR*30ISNTTRIVIAL7EHAVEA WHOLECHAPTERTHENEXTONEDEVOTEDTODEVELOPINGYOUROWNCUSTOM TAGHANDLERS"UTTHELASTPARTOFTHISCHAPTERISABOUTHOWTOUSECUSTOM TAGS7HATHAPPENSFOREXAMPLEIFSOMEONEHANDSYOUACUSTOMTAG LIBRARYTHEYCREATEDFORYOURCOMPANYORPROJECT(OWDOYOUKNOWWHAT THETAGSARE AND HOWTOUSETHEM7ITH*34, ITSEASYTHE*34,SPECIlCATIONDOCUMENTS EACHTAGINCLUDINGHOWTOUSEEACHOFTHE REQUIRED AND OPTIONALATTRIBUTES "UTNOTEVERYCUSTOMTAGWILLCOMESONICELY PACKAGED AND WELLDOCUMENTED9OUHAVE TOKNOWHOWTOlGUREOUTATAGEVENIFTHE DOCUMENTATIONISWEAKORNONEXISTENT AND  ONEMORETHINGYOUHAVETOKNOWHOWTO DEPLOYACUSTOMTAGLIBRARY 0DLQWKLQJVRXKDYHWRNQRZ  7KHWDJQDPHDQGVQWD[  7KHOLEUDU85, 7RXVHDFXVWRPOLEUDU RX08 67 UHDGWKH 7/ ' (YHUWKLQJRXQHHGWR NQRZLVLQWKHUH 4HETAGHASANAMEOBVIOUSLY)NCSETTHETAGNAMEISSET AND THEPRElXISC9OUCANUSEANYPRElXYOUWANTBUTTHE NAME COMESFROMTHE4,$4HESYNTAXINCLUDESTHINGSLIKEREQUIRED AND OPTIONALATTRIBUTESWHETHERTHETAGCANHAVEABODY AND IFSOWHATYOUCANPUTTHERETHETYPEOFEACHATTRIBUTE AND WHETHERTHEATTRIBUTECANBEANEXPRESSIONVSALITERAL3TRING 4HE52)ISAUNIQUEIDENTIlERINTHE4AG,IBRARY$ESCRIPTOR 4,$)NOTHERWORDSITSAUNIQUENAMEFORTHETAGLIBRARYTHE 4,$DESCRIBES4HE52)ISWHATYOUPUTINYOURTAGLIBDIRECTIVE )TSWHATTELLSTHE#ONTAINERHOWTOIDENTIFYTHE4,$lLEWITHIN THEWEBAPPWHICHTHE#ONTAINERNEEDSINORDERTOMAPTHETAG NAMEUSEDINTHE*30TOTHE*AVACODETHATRUNSWHENYOUUSE THETAG UHDGLQJWKH 7/ ' Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher:. x. UHDGLQJWKH 7/ ' Chapter 9. Custom tags are powerful Chapter 9. Custom tags are powerful Head First Servlets and JSP By Bert Bates, Kathy Sierra, Bryan Basham ISBN: 05960054 07 Publisher:. prohibited.  FKDSWHU +][WUQbQVOPMPQVOaW]QVKT]LM 2EMEMBERINTHEPREVIOUSCHAPTERWHENWEDIDA JSP INCLUDETO PUTINTHELAYOUTHEADERAGRAPHICWITHSOMETEXTBUTWEWANTED TOCUSTOMIZETHESUBTITLEUSEDINTHEHEADER7EUSED JSP PARAMTO MAKETHATHAPPEN 7KH-63ZLWKWKHMVSLQFOXGH! KWPO!ERG! MVSLQFOXGHSDJH

Ngày đăng: 12/08/2014, 19:20

Từ khóa liên quan

Mục lục

  • Custom tag development

Tài liệu cùng người dùng

Tài liệu liên quan