Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 74 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
74
Dung lượng
2,34 MB
Nội dung
FKDSWHU ?Q\P$K"QUXWZ\&\PMZMIZMVW_<0: _Ia[\WQVKT]LMKWV\MV\ 3OFARWEVEUSEDTWODIFFERENTWAYSTOADDCONTENTFROMANOTHER RESOURCEINTOA*30"UTTHERESYETANOTHERWAYUSING*34, 7KHLQFOXGH GLUHFWLYH #LQFOXGH¿OH ´+HDGHUKWPO´! 7KHMVSLQFOXGH! VWDQGDUGDFWLRQ MVSLQFOXGHSDJH ´+HDGHUMVS´! 7KHFLPSRUW!-67/WDJ FLPSRUWXUO ´KWWSZZZZLFNHGO\VPDUWFRPVN\OHUKRUVHKWPO´! 3TATICADDSTHECONTENTFROMTHEVALUEOFTHElLE ATTRIBUTETOTHECURRENTPAGEATTRANSLATIONTIME $YNAMICADDSTHECONTENTFROMTHEVALUEOFTHE PAGEATTRIBUTETOTHECURRENTPAGEATREQUESTTIME $YNAMICADDSTHECONTENTFROMTHEVALUEOFTHE 52,ATTRIBUTETOTHECURRENTPAGEATREQUESTTIME )TWORKSALOTLIKEJSPINCLUDEBUTITSMORE POWERFULANDmEXIBLE Unlike the other two includes, the <c:import> url can be from outside the web Container! (DFKRIWKHWKUHHPHFKDQLVPVIRULQFOXGLQJFRQWHQWIURPDQRWKHUUHVRXUFHLQWR\RXU-63XVHVD GLIIHUHQWZRUGIRUWKHDWWULEXWH7KHLQFOXGHGLUHFWLYHXVHV¿OHWKHMVSLQFOXGH!XVHVSDJHDQG WKH-67/FLPSRUW!WDJXVHVXUO7KLVPDNHVVHQVHZKHQ\RXWKLQNDERXWLWEXW\RXGRKDYH WRPHPRUL]HDOOWKUHH7KHGLUHFWLYHZDVRULJLQDOO\LQWHQGHGIRUVWDWLFOD\RXWWHPSODWHVOLNH+70/ KHDGHUV,QRWKHUZRUGVD³¿OH´7KHMVSLQFOXGH!ZDVLQWHQGHGPRUHIRUG\QDPLFFRQWHQW FRPLQJIURP-63VVRWKH\QDPHGWKHDWWULEXWH³SDJH´WRUHÀHFWWKDW7KHDWWULEXWHIRUFLPSRUW! LVQDPHGIRUH[DFWO\ZKDW\RXJLYHLW²D85/5HPHPEHUWKH¿UVWWZR³LQFOXGHV´FDQ¶WJRRXWVLGH WKHFXUUHQW&RQWDLQHUEXWFLPSRUW!FDQ 7KH\DOOKDYHGLIIHUHQWDWWULEXWHQDPHV $QGZDWFKRXWIRU´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). WKHFLPSRUW!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/ \RXDUHKHUH $K"QUXWZ\&KIVZMIKP7=<;1,-\PM_MJIXX 7ITHJSPINCLUDEORTHEINCLUDEDIRECTIVEYOUCANINCLUDEONLYPAGESTHATAREPARTOFTHE CURRENTWEBAPP"UTNOWWITHCIMPORTYOUHAVETHEOPTIONTOPULLINCONTENTFROM OUTSIDETHE#ONTAINER4HISSIMPLEEXAMPLESHOWSA*30ON3ERVER!IMPORTINGTHECONTENTS OFA52,ON3ERVER"!TREQUESTTIMETHE(4-,CHUNKINTHEIMPORTEDlLEISADDEDTO THE*304HEIMPORTEDCHUNKUSESAREFERENCETOANIMAGETHATISALSOON3ERVER" #WDJOLESUH¿[ ´F´XUL ´KWWSMDYDVXQFRPMVSMVWOFRUH´! KWPO!ERG\! FLPSRUWXUO ´KWWSZZZZLFNHGO\VPDUWFRPVN\OHUKRUVHKWPO´! EU! 7KLVLVP\KRUVH ERG\!KWPO! 7KH-63 LPJVUF ´KWWSZZZZLFNHGO\VPDUWFRPVN\OHUKRUVHJLI´! 7KHLPSRUWHGÀOH % $ 6HUYHU$WKH-63GRLQJWKHLPSRUW 6HUYHU%WKHLPSRUWHGFRQWHQW KWWSORFDOKRVWWHVW-637HVWHUGR 7KLVLVP\KRUVH 7KHUHVSRQVH 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\PQVOaW]QVKT]LM 2EMEMBERINTHEPREVIOUSCHAPTERWHENWEDIDAJSPINCLUDETO PUTINTHELAYOUTHEADERAGRAPHICWITHSOMETEXTBUTWEWANTED TOCUSTOMIZETHESUBTITLEUSEDINTHEHEADER7EUSEDJSPPARAMTO MAKETHATHAPPEN 7KH-63ZLWKWKHMVSLQFOXGH! KWPO!ERG\! MVSLQFOXGHSDJH ´+HDGHUMVS´! MVSSDUDPQDPH ´VXE7LWOH´YDOXH ´:HWDNHWKHVWLQJRXWRI62$3´! MVSLQFOXGH! EU! HP!:HOFRPHWRRXU:HE6HUYLFHV6XSSRUW*URXSHP!EU!EU! &RQWDFWXVDW^LQLW3DUDPPDLQ(PDLO` ERG\!KWPO :HWDNHWKHVWLQJRXWRI62$3 KWWSORFDOKRVWWHVWV&RQWDFWMVS :HOFRPHWRRXU:HE6HUYLFHV6XSSRUW*URXS &RQWDFWXVDWOLNHZHFDUH#ZLFNHGO\VPDUWFRP LPJVUF ´LPDJHV:HE6HUYLFHVMSJ´!EU! HP!VWURQJ! ^SDUDPVXE7LWOH`VWURQJ!HP! EU! 7KHLQFOXGHGÀOH´+HDGHUMVSµ ( YL We made the subtitle ÒWe take the sting Ó available to the header JSP by setting it as a new request parameter. WKHFLPSRUW!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/ \RXDUHKHUH ,WQVO\PM[IUM\PQVO_Q\P$K"XIZIU& (EREWEACCOMPLISHTHESAMETHINGWEDIDONTHEPREVIOUSPAGEBUT USINGACOMBINATIONOFCIMPORTANDCPARAM9OULLSEETHATTHE STRUCTUREISVIRTUALLYIDENTICALTOTHEONEWEUSEDWITHSTANDARDACTIONS 7KH-63ZLWKWKHMVSLQFOXGH! #WDJOLESUH¿[ ´F´XUL ´KWWSMDYDVXQFRPMVSMVWOFRUH´! KWPO!ERG\! FLPSRUWXUO ´+HDGHUMVS´! FSDUDPQDPH ´VXE7LWOH´YDOXH ´:HWDNHWKHVWLQJRXWRI62$3´! FLPSRUW! EU! HP!:HOFRPHWRRXU:HE6HUYLFHV6XSSRUW*URXSHP!EU!EU! &RQWDFWXVDW^LQLW3DUDPPDLQ(PDLO` ERG\!KWPO! LPJVUF ´LPDJHV:HE6HUYLFHVMSJ´!EU! HP!VWURQJ! ^SDUDPVXE7LWOH`VWURQJ!HP! EU! 7KHLQFOXGHGÀOH´+HDGHUMVSµ 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\WRFKDQJHWKHVXEMHFW KHUHEXW,MXVWQRWLFHG D+8*(SUREOHPZLWK-63V +RZFDQ\RXJXDUDQWHHVHVVLRQ WUDFNLQJIURPD-63ZLWKRXW XVLQJVFULSWLQJ" 6HVVLRQWUDFNLQJ KDSSHQVDXWRPDWLFDOO\ZLWK -63VXQOHVV\RXH[SOLFLWO\GLVDEOH LWZLWKDSDJHGLUHFWLYHWKDWKDV DVHVVLRQDWWULEXWHWKDWVD\V VHVVLRQ µIDOVHµ +HPLVVHGWKHSRLQW,VDLG ´JXDUDQWHHµ0\UHDOTXHVWLRQLVLI WKHFOLHQWGRHVQ·WVXSSRUWFRRNLHVKRZ FDQ,JHW85/UHZULWLQJWRKDSSHQ"+RZ FDQ,JHWWKHVHVVLRQ,'DGGHGWR WKH85/VLQP\-63" $KKKKHREYLRXVO\ GRHVQ·WNQRZDERXWWKH FXUO!WDJ,WGRHV85/ UHZULWLQJDXWRPDWLFDOO\ 85/UHZULWLQJLQD-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/ \RXDUHKHUH $K"]ZT&NWZITTaW]ZPaXMZTQVSVMML[ 2EMEMBERWAYBACKINOUROLDSERVLETDAYSWHENWEWANTEDTOUSEASESSION&IRST WEHADTOGETTHESESSIONEITHERTHEEXISTINGONEORANEWONE!TTHATPOINTTHE #ONTAINERKNOWSTHATITSSUPPOSEDTOASSOCIATETHECLIENTFROMTHISREQUESTWITHA PARTICULARSESSION)$4HE#ONTAINERWANTSTOUSEACOOKIEITWANTSTOINCLUDEA UNIQUECOOKIEWITHTHERESPONSEANDTHENTHECLIENTWILLSENDTHATCOOKIEBACKWITH EACHSUBSEQUENTREQUEST%XCEPTONEPROBLEMTHECLIENTMIGHTHAVEABROWSERWITH COOKIESDISABLED4HENWHAT 4HE#ONTAINERWILLAUTOMATICALLYFALLBACKTO52,REWRITINGIFITDOESNTGETACOOKIE FROMTHECLIENT"UTWITHSERVLETSYOU34),,HAVETOENCODEYOUR52,S)NOTHER WORDSYOUSTILLHAVETOTELLTHE#ONTAINERTOhAPPENDTHEJSESSIONIDTOTHEENDOFTHIS PARTICULAR52,vFOREACH52,WHEREITMATTERS7ELLYOUCANDOTHESAMETHING FROMA*30USINGTHECURLTAG 85/UHZULWLQJIURPDVHUYOHW SXEOLFYRLGGR*HW+WWS6HUYOHW5HTXHVWUHTXHVW+WWS6HUYOHW5HVSRQVHUHVSRQVH WKURZV,2([FHSWLRQ6HUYOHW([FHSWLRQ^ UHVSRQVHVHW&RQWHQW7\SH³WH[WKWPO´ 3ULQW:ULWHURXW UHVSRQVHJHW:ULWHU +WWS6HVVLRQVHVVLRQ UHTXHVWJHW6HVVLRQ RXWSULQWOQ³KWPO!ERG\!´ RXWSULQWOQ³DKUHI ?´´ UHVSRQVHHQFRGH85/³%HHU7HVWGR´³?´!FOLFND!´ RXWSULQWOQ³ERG\!KWPO!´ ` Add the extra session ID info to this URL. 85/UHZULWLQJIURPD-63 #WDJOLESUH¿[ ´F´XUL ´KWWSMDYDVXQFRPMVSMVWOFRUH´! KWPO!ERG\! 7KLVLVDK\SHUOLQNZLWK85/UHZULWLQJHQDEOHG DKUHI ´ FXUOYDOXH ¶LQSXW&RPPHQWVMVS¶!´!&OLFNKHUHD! 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=:4VMML[MVKWLQVO' 2EMEMBERTHATINAN(440'%4REQUESTTHEPARAMETERSAREAPPENDEDTOTHE52,ASAQUERYSTRING &OREXAMPLEIFAFORMONAN(4-,PAGEHASTWOTEXTlELDSlRSTNAMEANDLASTNAMETHEREQUEST 52,WILLSTICKTHEPARAMETERNAMESANDVALUESONTOTHEENDOFTHEREQUEST52,"UTAN(440 REQUESTWONTWORKCORRECTLYIFITCONTAINSUNSAFECHARACTERSALTHOUGHMOSTMODERNBROWSERSWILLTRY TOCOMPENSATEFORTHIS )FYOUREAWEBDEVELOPERTHISISOLDNEWSBUTIFYOURENEWTOWEBDEVELOPMENTYOUNEEDTOKNOW THAT52,SOFTENNEEDTOBEENCODED52,ENCODINGMEANSREPLACINGTHEUNSAFERESERVEDCHARACTERS WITHOTHERCHARACTERSANDTHENTHEWHOLETHINGISDECODEDAGAINONTHESERVERSIDE&OREXAMPLE SPACESARENTALLOWEDINA52,BUTYOUCANSUBSTITUTEAPLUSSIGNhvFORTHESPACE4HEPROBLEMIS CURLDOES./4AUTOMATICALLYENCODEYOUR52,S 8VLQJFXUO!ZLWKDTXHU\VWULQJ FVHWYDU ´ODVW´YDOXH ´+LGGHQ&XUVRU´! FVHWYDU ´¿UVW´YDOXH ´&URXFKLQJ3L[HOV´! FXUOYDOXH ´LQSXW&RPPHQWVMVS"¿UVW ^¿UVW`ODVW ^ODVW`´YDU ´LQSXW85/´! 7KH85/XVLQJSDUDPVLV^LQSXW85/`EU! 2EMEMBERTHECURLTAGDOES52,REWRITINGBUTNOT52,ENCODING KWWSORFDOKRVWWHVWVULVN\MVS 7KH85/XVLQJSDUDPVLVP\$SSLQSXW&RPPHQWV MVS"ÀUVW &URXFKLQJ3L[HOVODVW +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 8VLQJFSDUDP!LQWKHERG\RIFXUO! 4HISSOLVESOURPROBLEM.OWWEGETBOTH52,REWRITINGAND52,ENCODING FXUOYDOXH ´LQSXW&RPPHQWVMVS´YDU ´LQSXW85/´! FSDUDPQDPH ´¿UVW1DPH´YDOXH ´^¿UVW`´! FSDUDPQDPH ´ODVW1DPH´YDOXH ´^ODVW`´! FXUO! no slash .OWTHE52,LOOKSLIKETHIS P\$SSLQSXW&RPPHQWVMVS"¿UVW1DPH &URXFKLQJ3L[HOVODVW1DPH +LGGHQ&XUVRU Now weÕre safe, because <c:param> takes care of the encoding! WKHF85/!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/ \RXDUHKHUH AW]LW67<_IV\aW]ZKTQMV\[\W[MM\PQ[" ,·PLQWHUUXSWLQJWKLV-67/ WDONIRUDIHZPRPHQWVWR WDONDERXW\RXUHUURUKDQGOLQJ :H·UHDERXWWRGRVRPHWKLQJWKDW PLJKWFDXVHDQH[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 5ISMaW]ZW_VMZZWZXIOM[ 4HEGUYSURlNGYOURSITEDOESNTWANTTOSEEYOURSTACKTRACE!NDHESNOTTOO THRILLEDTOGETASTANDARDh.OT&OUNDvEITHER 9OUCANTPREVENTALLERRORSOFCOURSEBUTYOUCANATLEASTGIVETHEUSERAFRIENDLIER ANDMOREATTRACTIVEERRORRESPONSEPAGE9OUCANDESIGNACUSTOMPAGETOHANDLE ERRORSTHENUSETHEPAGEDIRECTIVETOCONlGUREIT 7KHGHVLJQDWHG(5525SDJH´HUURU3DJHMVSµ #SDJH LV(UURU3DJH ´WUXH´! KWPO!ERG\! VWURQJ!%XPPHUVWURQJ! LPJVUF ´LPDJHVEXPPHU*X\MSJ´! ERG\!KWPO! 7KH%$'SDJHWKDWWKURZVDQH[FHSWLRQ´EDG3DJHMVSµ #SDJH HUURU3DJH ´HUURU3DJHMVS´! KWPO!ERG\! $ERXWWREHEDG LQW[ ! ERG\!KWPO! :KDWKDSSHQVZKHQ\RXUHTXHVW´EDG3DJHMVSµ %XPPHU KWWSORFDOKRVWWHVWVEDG3DJHMVS 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Ó. HUURUSDJHV 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/ \RXDUHKHUH ;PMLWM[V¼\SVW_IJW]\\PM$MZZWZXIOM&,,\IO 9OUCANDECLAREERRORPAGESINTHE$$FORTHEENTIREWEBAPPANDYOU CANEVENCONlGUREDIFFERENTERRORPAGESFORDIFFERENTEXCEPTIONTYPESOR (440ERRORCODETYPESETC 4HE#ONTAINERUSESERRORPAGECONlGURATIONINTHE$$ASTHE DEFAULTBUTIFA*30HASANEXPLICITERROR0AGEPAGEDIRECTIVETHE #ONTAINERUSESTHEDIRECTIVE ,WZLOOWDNHPH)25(9(5WRSXW SDJHGLUHFWLYHVLQDOOP\-63VWR VSHFLI\WKHHUURUSDJHWRXVH$QG ZKDWLI,ZDQWDGLIIHUHQWHUURUSDJH GHSHQGLQJRQWKHHUURU",IRQO\WKHUH ZHUHDZD\WRFRQÀJXUHHUURUSDJHV IRUWKHZKROHZHEDSS 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 =[QVOIIOTQJZIZaPI¼[ 67& lt;NZWUPM2;<4 #REATINGTHECODETHATGOESBEHINDATAGINOTHERWORDSTHE*AVACODE THATSINVOKEDWHENYOUPUTTHETAGINYOUR*30ISNTTRIVIAL7EHAVEA WHOLECHAPTERTHENEXTONEDEVOTEDTODEVELOPINGYOUROWNCUSTOM TAGHANDLERS"UTTHELASTPARTOFTHISCHAPTERISABOUTHOWTOUSECUSTOM TAGS7HATHAPPENSFOREXAMPLEIFSOMEONEHANDSYOUACUSTOMTAG LIBRARYTHEYCREATEDFORYOURCOMPANYORPROJECT(OWDOYOUKNOWWHAT THETAGSARE AND HOWTOUSETHEM7ITH*34, ITSEASYTHE*34,SPECIlCATIONDOCUMENTS EACHTAGINCLUDINGHOWTOUSEEACHOFTHE REQUIRED AND OPTIONALATTRIBUTES "UTNOTEVERYCUSTOMTAGWILLCOMESONICELY PACKAGED AND WELLDOCUMENTED9OUHAVE TOKNOWHOWTOlGUREOUTATAGEVENIFTHE DOCUMENTATIONISWEAKORNONEXISTENT AND ONEMORETHINGYOUHAVETOKNOWHOWTO DEPLOYACUSTOMTAGLIBRARY 0DLQWKLQJVRXKDYHWRNQRZ 7KHWDJQDPHDQGVQWD[ 7KHOLEUDU85, 7RXVHDFXVWRPOLEUDU RX08 67 UHDGWKH 7/ ' (YHUWKLQJRXQHHGWR NQRZLVLQWKHUH 4HETAGHASANAMEOBVIOUSLY)NCSETTHETAGNAMEISSET AND THEPRElXISC9OUCANUSEANYPRElXYOUWANTBUTTHE NAME COMESFROMTHE4,$4HESYNTAXINCLUDESTHINGSLIKEREQUIRED AND OPTIONALATTRIBUTESWHETHERTHETAGCANHAVEABODY AND IFSOWHATYOUCANPUTTHERETHETYPEOFEACHATTRIBUTE AND WHETHERTHEATTRIBUTECANBEANEXPRESSIONVSALITERAL3TRING 4HE52)ISAUNIQUEIDENTIlERINTHE4AG,IBRARY$ESCRIPTOR 4,$)NOTHERWORDSITSAUNIQUENAMEFORTHETAGLIBRARYTHE 4,$DESCRIBES4HE52)ISWHATYOUPUTINYOURTAGLIBDIRECTIVE )TSWHATTELLSTHE#ONTAINERHOWTOIDENTIFYTHE4,$lLEWITHIN THEWEBAPPWHICHTHE#ONTAINERNEEDSINORDERTOMAPTHETAG NAMEUSEDINTHE*30TOTHE*AVACODETHATRUNSWHENYOUUSE THETAG UHDGLQJWKH 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. UHDGLQJWKH 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 +][WUQbQVOPMPQVOaW]QVKT]LM 2EMEMBERINTHEPREVIOUSCHAPTERWHENWEDIDA JSP INCLUDETO PUTINTHELAYOUTHEADERAGRAPHICWITHSOMETEXTBUTWEWANTED TOCUSTOMIZETHESUBTITLEUSEDINTHEHEADER7EUSED JSP PARAMTO MAKETHATHAPPEN 7KH-63ZLWKWKHMVSLQFOXGH! KWPO!ERG! MVSLQFOXGHSDJH