index.fm Page 477 Tuesday, May 15, 2001 11:06 AM

A Advanced concepts, custom tags, 32-59 Ancestor tags, locating, 57-58 AbstractAuthenticator class, Resin, 266 Apache Struts, 95, 155 /accountCreated.jsp, 152 -Java 1.2.2, 332 AccountLink.jsp, 446 -Java 1.2.2, 332 ActionBase class, 188, 193, 194 , 365 ActionEvent.ACTION_AFTER_PERFORM, 185 AppAuthenticateServlet.java ActionEvent class, 184, 186-87 , 432, 453-54 app_de.properties sequence diagram, 185 , 441 app_en.properties ActionFactory interface, Model 2 framework, , 233, 240, 399, 440-41 app_es.properties 156, 159 , 233 app_fr.properties Action interface, Model 2 framework, 156, 158, , 240 187-88, 193-94 app_ko.properties, 241 ActionListener interface, 184, 185-86 Application life cycle events, 183 afterAction method, 186 app_zh.properties, 441 beforeAction method, 186, 196 elements, 18 ActionRouter interface, Model 2 framework, 156, attribute element, , 12 160 , 269 ActionServlet interface, Model 2 framework, elements, 270 156, 161-65, 166-68, 189 AuthenticateFilter.java, 474-75 actions.properties, 166, 174, 402 AuthenticateServlet.java, 278-79, 432, AddToCartAction.java, 406-8 454-55

index.fm Page 478 Tuesday, May 15, 2001 11:06 AM

478 Index

authenticate tag, 28 advantages over direct access of multiple AuthenticateTag, 29 resource bundles, 224 Authentication, 443-55 using, 223 basic, 256-59 BundleCache.java, 223-24 client certificate, 263 BundleLocator.java, 236-37 customizing, 263-69 digest, 259-60 C form-based, 260-63 capitalize tag, 46-47 programmatic, 271-81 Case study, 390-469 servlet, 251-55 authenticate user use case, 443-44 types of, 255 authentication, 443-55 HTML forms, 455-63 B internationalization, 438-43 Basic authentication, 256-59 Model 2 framework, 416-38 Beans: actions, 437-38 and forms, 61-69 beans, 420-26 from regions custom tag library, 122-30 controllers, 432-38 generating from XML, 338-39 database, 417-20 generating XML with, 334-38 model, 416-17 beans.html package, 79 servlets, 432-37 class diagram for, 84 views, 426-32 Blank finals, 139fn online fruitstand, 391-416 AddToCartAction.java, 406-8 Body content, 7, 33, 46-56 application overview, 394 accessing in doEndTag(), 53 CartIteratorTag.java, 409 how it works, 48-53 /cart.jsp, 408 JavaScript, generating, 54-56 checkout, 410-14 manipulating, 50 CheckoutAction.java, 410 BodyContent class, 48-56 CHECKOUT_REGION, 412 class diagram, 49 /content.jsp, 404-6, 412-13, getString method, 56 415-16, 446, 448, 452, 455-59, 465, bodycontent element, , 12 466-68 BodyContent objects, 49 CreateAccountForm.java, Body tag handlers, 27-29, 34-36 460-62 BodyTag interface, 27, 29, 34-35, 40 /form.jsp, 453 BodyTagSupport class, 27, 35-36 Going Shopping button, 400-402 iteration, 36-40 GoShoppingAction.java, 401-2 BodyTag interface, 27, 29, 34-35, 46 home page, 392, 395-402 BodyTagSupport class, 27, 35-36, 47, 49, /index.jsp, 396, 402 122 JSP files, 395 /bookInventory., 345 /page.jsp, 403, 411, 415, 430-31, boolean hasRole(Principal 445 principal, String role), purchase, 414-16 267 PurchaseAction.java, 414 boolean isSecure(), 254 QueryAccountAction class, boolean isUserInRole(String), 253 447-48, 464 BORDER_REGION, 111-12 regionDefinitions.jsp, 397 Browser language preferences, 233-37 shopping cart, 406-10 locales, detecting, 233-34 /sidebar.jsp, 404 resource bundles, locating, 235-37 storefront, 402-6 Bundle cache, 222-24 use case, 393-94

index.fm Page 479 Tuesday, May 15, 2001 11:06 AM

Index 479

ValidateAccountAction.java, CreateAccountForm.java, online 450, 459-60 fruitstand, 460-62 validate-account.jsp, 449-50, CreateDB constructor, 286 459 CreateDB.java, 417, 418-20 web.xml, 395-96 create-tokens custom tag, 202-3 sensitive form resubmissions, 464-65 tag handler, 203-4 SSL, 465-66 CreditElement class, 90-91 XML, 466-68 curator role, 106-8 categorySelectionAttr method, 78, 80 Currency, formatting, 227-29 Charsets, 209-11 Customizing authentication, 263-69 multilingual JSP pages, 211 CustomRealm class, 268-69 non-Latin-based JSP pages, 209-10 Custom tag IDs, using, 44-46 specifying, 210 Custom tags, 2-30, 93-94, 95, 283 CheckboxElement class, 80, 87 and access to page information, 20-22 Checkboxes, 65-69 advanced concepts, 32-59 beans for, 66 attributes, 12, 14-20 adding, 15 CheckoutAction.java, 410 with bodies, 27-29 CHECKOUT_REGION, 412 body content, 7, 33, 46-56 check-tokens custom tag, 202-3 body tag handlers, 27-29, 34-36 tag handler for, 204 for database access, 287-301 Client certificate authentication, 263 database access with, 4 Client-side validation with JavaScript, 69-72 defining, 6-7 Code reuse, 92 (DOM), 364-74 ColumnIteratorTagInfo.java, 298-99 empty, 5 ColumnIteratorTag.java, 294-96 and encapsulation of JSP and JavaScript columnNames tag, 4, 284, 289, 293-97, 320 functionality, 56 ColumnNamesTagInfo.java, 297 error handling, 22-23 ColumnNamesTag.java, 296 and extension of TagSupport or columns tag, 4, 284, 289, 297-99, 320 BodyTagSupport, 27 ColumnsTag.java, 297-98 features of, 4-5 Composite design pattern, 97 fundamentals of, 2-30 CONFIDENTIAL transport guarantee, 270-71 implementing, 7-10 Connection pool, 302-14 and internationalization, 237-48 creating, 303-5 and JSP, 3-4 implementing, 305-14 JSP file, 5-6 industrial-strength, 308-14 libraries, 5, 7, 29 simple pool, 305-8 and Model 2 architecture, 175-77 using, 302-3 power of, 5 connect tag, 4 SAX (Simple API for XML), 346-54 Constants.java, 426 scripting variables, 41-46 Content class, 116-19 Tag interface, 7-8, 25-26 /content.jsp, online fruitstand, 404-6, tag package, 23-24 412-13, 415-16, 446, 448, 452, using, 5-6 455-59 and XML specification, 5 Core J2EE Patterns (Alur/Crupi/Malks), 98 XPath, 385 .counter suffix, 9 Counter tag, 5-6 D body content, 7 Databases, 282-329 interaction diagram for, 13 columnNames tag, 4, 284, 289, 293-97 CounterTag.doEndTag, 10 columns tag, 4, 284, 289, 297-99 CounterTag.doStartTag, 10 connection pool, 302-14 index.fm Page 480 Tuesday, May 15, 2001 11:06 AM

480 Index

Databases (continued) DOM, See Document Object Model (DOM) creating, 303-5 DOMParserBean.java, 356 implementing, 305-14 DOMParserTagInfo.java, 367 using, 302-3 DOMParserTag.java, 365-66 creating, 284-86 doStartTag method, Tag interface, 8, 12, custom tags, 287-301 25 data sources, 287 prepared statements, 314-20 E query tag, 4, 284, 289-93, 303 empty custom tags, 5 release tag, 284, 289, 301, 303 Encapsulating layout, 98-103 rows tag, 4, 284, 299-301 sections/regions/templates, 100-103 scrolling through result sets, 324-29 Enclosing writer, defined, 49 transactions, 320-24 enforceLogin tag, 272-73, 279, 431 database.tld, 348 EnforceLoginTag.java, 275-76, 445 DateFormat class, 225-26 /error.jsp, 262, 280-81 date.xml, 37 error-page attribute, enforceLogin /date., 375-76 tag, 272-73 Declarative authentication, 254 errors_en.properties, 241 /Definitions.jsp, 428-29 errors_fr.properties, 241 description element: EVAL_BODY_INCLUDE, 29, 58-59, 177 , 270 EVAL_BODY_TAG, 38-39 , 270 EVAL_PAGE, 10, 13, 26, 276 , 270 Event handling, 182-205 Design, 132-54 for Model 2 framework, 184-89 Model 1 architecture, 133, 134-35 Exceptions, 22-23 Model 2 architecture, 135-81 ExecutePreparedStatementTag.java, refining, 165-71 319-20 Design Patterns: executePrepareStatement tag, 284 composite, 97, 110, 117 EXTENDED_SIDEBAR_REGION, 112-14, 116 composite view, 98 Extending regions, 112-14 facade, 79, 425 front controller, 205 F memento, 61 Facade design pattern, 79-80, 95 strategy, 97 findAncestorWithClass, 57-58 Digest authentication, 259-60 /flags.jsp, 400, 442 direct attribute, region:render tag, 102 /footer.jsp, 399 doAfterBody, 38-39, 47, 53, 56 format tag, 237, 243-48 Document Object Model (DOM), 354-74 tag handler for, 245-46 custom tags, 364-74 FormatTag class, 245-48 defined, 354 Form-based authentication, 260-63 DOM tree, 355 Form bean, 65 walking, 361-62 form custom tag, 93 and online fruitstand case study, 466-68 Form framework, 77-92 doEndTag method, Tag interface, 8, 12, 25, major benefit of, 92 52, 53 selectable elements, 87-92 doFilter method, 475 using, 81-87 doInitBody, 38 Form-handling code reuse, 92 , 365 Form.java, 65, 68-69, 83, 90 , 365 form.jsp, 63-64, 67, 70-71, 81-82 , 365 FormTag.java, 93-94 , 365 Form Taglib, 95 , 365 FULL constant, DateFormat class, 225, 227 index.fm Page 481 Tuesday, May 15, 2001 11:06 AM

Index 481

G I getActionClass, 168 i10n, See Localization GetElementValueTagInfo.java, 374 i18n:format tag, 399, 416 GetElementValueTag.java, 373 i18n:message tag, 399-400, 416 getNumberInstance method, 227 i18n, See Internationalization GetRequesParameterTag class, 19 id attribute, query tag, 288, 291 interaction diagram for, 19 ifElementNameEquals tag, 347 getVariableInfo method, 43 ifElementNameEqualsTag.java, 353, GoShoppingAction.java, 401-2 354 ifElementNameNotEqualsTag.java, H 354 IfNodeIsElementTag.java, 372-73 /header.jsp, 102, 105, 399 IfNodeNameEqualsTag.java, 371-72 HintAvailableTag.java, 177 IN16JSP Tag Library, 95 HintNotAvailableTag.java, 177 /index.jsp, 115 Home page, online fruitstand, 392, 395-402 online fruitstand, 396, 402 HOMEPAGE_REGION, 398, 429 info element: /hscf.jsp, 106, 116, 428, 430 , 12 HTML, 331 , 11 HTML forms, 60-95 input tag, HTML, 78, 80 with beans, 61-69 INTEGRAL transport guarantee, 270-71 checkboxes, 65-69 Internationalization, 206-49, 400, 438-43 code reuse, 92 browser language preferences, 233-37 custom tags, 93-94 charsets, 209-11 facade design pattern for, 79-80, 95 custom tags, 237-48 form framework, 77-92 defined, 207 and fruitstand case study, 455-63 locales, 211-13 lists, 65-69 locale-sensitive information, formatting, Memento design pattern, 62 224-33 and online fruitstand case study, 455-63 resource bundles, 213-24 options, 65-69 Unicode, 208-9 radio buttons, 62-65 Internet Explorer, 207, 233 text areas, 62-65 downloading/installing, 210 Inventory.java textfields, 62-65 , 335, 337, 425 inventory.jsp transmission of form data, 62 / , 334-35 inventory-to-xml.jsp validation, 69-77 / , 468 /inventory.xml, 377, 378 client-side with JavaScript, 69-72 /inventory.xsl, 377, 379-80 server-side with JSP, 72-73 Item.java, 336, 337-38, 424 server-side with servlets, 73-75 iterateElements tag, 347, 352 server side with servlets and JSP tag handler for, 350-51 pages, 75-77 iterate tag, 33-34, 37-39, 41-42, 47 http-method element, Iteration, body tag handlers, 36-40 , IteratorTag class, 37-39, 42, 388 270 interaction diagram, 40 HttpServletRequest: methods, 38 security methods, 253-54 IteratorTagInfo class, 42-43 for principals/roles, 253 HttpServletResponse.encodeURL, 144 J HttpSession getSession() method, J2EE Composite View pattern, 98 PageContext, 21 Java, 331 index.fm Page 482 Tuesday, May 15, 2001 11:06 AM

482 Index

Java Development Kit (JDK) 1.3, 332 dates/times, 225-27 java.security.Principal interface, messages, 229-33 269 numbers/currency/percents, 227-29 JavaServer Pages (JSP): Localization, 206-49 and creation of tags, 3-4 defined, 207 custom tags, 3-5 LoginAction class, 164-65 libraries, 5, 7, 29 LoginDB class, 139-40, 146, 274-75 power of, 5 /loginFailed.jsp, 150, 175 simple, 11 Login fails sequence diagram, 280 tag life cycle, 12-13 /login-form.jsp, 144, 165, 170 and XML specification, 5 /login.jsp, 144, 276-77 generating XML with, 331 login-page attribute, enforceLogin and JavaScript, 56 tag, 273 using with XSLT, 376-77 LOGIN_REGION, 429-30 XML format: LoginServlet.java, 145 usefulness of, 384 Login succeeds sequence diagram, 279 See also XML LONG constant, DateFormat class, 225 Java Specification Request (JSR), 5 java.text.DateFormat class, 225-26 M java.text.MessageFormat class, MEDIUM DateFormat 229-30 constant, class, 225 java.text package, 224 Memento design pattern, 62, 95 MessageFormat java.util.Vector class, 140 class, 229-30 javax.servlet.Filter interface, 475 Message formatting, 229-33 message javax.servlet.jsp.tagext package, tag, 237, 238-43 23-24, 42 attributes, 243 base JDBC, 283, 287 attribute, 238, 243 key DataSource interface, 287 attribute, 243 locale JDBC API Tutorial and Reference, 283 attribute, 243 jsp:setProperty tag, 78 and message formatting, 238 params JSP custom tags, See Custom tags attribute, 243 MessageTag.java JSPExceptions, 22-23 , 241-42 JSP scripts, 178-80 Model 1 architecture, 133, 134-35 JSP specification, version 0.91, See Model 1 components of, 134 architecture functions of, 134 jspversion element, , 11 pros/cons, 135 JspWriter, 51 Model 2 architecture, 135-81, 331 JspWriter getOut() method, custom tags, importance of, 175-77 PageContext, 21 defined, 136 encapsulation of Java code in servlets, 147 example, 137-52 L beans, 138-40 Layout managers, 97 deployment descriptor, 140-42 Libraries, of JSP custom tags, 5, 7, 29 new account sequence diagram, 149 links tag, 56 new account use case, 147-52 LinksTag class, 56 retrofitting, 162-65 ListResourceBundle method, 216 successful login use case, 142-47 List resource bundles, 215-19 framework, 154-81 using, 217 adding use cases, 171-75 Lists, 65-69 classes and interfaces, 156 Locales, 211-13 event handling, 184-89 Locale-sensitive information formatting, extending without modifying, 189 224-33 JSP scripts, 178-80 index.fm Page 483 Tuesday, May 15, 2001 11:06 AM

Index 483

functions of, 135-36 GoShoppingAction.java, 401-2 with XML and XSLT, 332 home page, 392, 395-402 Model-View-Controller (MVC) architecture, /index.jsp, 396, 402 133, 136, 155 JSP files, 395 benefits of, 137 /page.jsp, 403, 411, 415, 430-31 Multilingual JSP pages, 211 purchase, 414-16 Multiple resource bundles, 221-24 PurchaseAction.java, 414 bundle cache, 222-24 regionDefinitions.jsp, 397 using, 222 shopping cart, 406-10 /sidebar.jsp, 404 N storefront, 402-6 use case, 393-94 , 7 validate-account.jsp, 449-50, 459 name element: web.xml, 395-96, 433-34 , 18 Optional content, 103-6 , 12 Options, 65-69 NameElement class, 90-92, 462, 463 beans for, 66 names.xml, 386 OptionsElement class, 87 Nested tags, 25, 57-59 option tags, HTML, 55, 65 ancestor tags, locating, 57-58 sharing data, 58-59 P Nesting regions, 110-12 Netscape Communicator, 207, 233 PageContext class, 20-24 downloading/installing, 210 methods for custom tag implementers, 21 NewAccountAction class, 164-65, 169, pageContext instance, 20-22 192, 451-52, 464 PageContext.popBody, 52-53 /newAccount.jsp, 150-51, 199-200 Page information access, and custom tags, NewAccountServlet class, 151 20-22 NodeIteratorTagInfo.java, 370-71 /page.jsp, online fruitstand, 403, 411, 415, NodeIteratorTag.java, 369-70 430-31, 445 NONE transport guarantee, 270-71 Parameterized text, 229 NumberFormat class, 227-29 Parent tags, 25 Parsing XML, 332, 341-74 Document Object Model (DOM), 354-74 O SAX (Simple API for XML), 351-54 Object findAttribute(String) popBody method, 52-53 method, PageContext, 21 Portability, and servlet authentication, Object getAttribute(String) 254-55 method, PageContext, 21 Postprocessing XML, 339-41 Object-Oriented Software Engineering prefix attribute, taglib directive, 6 (Jacobsen), 142 PreparedStatement class, 314-15 Online fruitstand, 391-416 Prepared statements, 314-20 AddToCartAction.java, 406-8 PreparedStatementTag.java, 317-18 application overview, 394 prepareStatement tag, 284 CartIteratorTag.java, 409 tag handler for, 317-18 /cart.jsp, 408 Previous out, defined, 49 checkout, 410-14 Principal getPrincipal(String CheckoutAction.java, 410 user), 267 CHECKOUT_REGION, 412 Principal getUserPrincipal(), 253 /content.jsp, 404-6, 412-13, 415-16, Principals, 252-54 446, 448, 452, 455-59 PrintBodyTag.doAfterBody, 53 CreateAccountForm.java, 460-62 printBody tags, 50-53 Going Shopping button, 400-402 /printXML.jsp, 362-63 index.fm Page 484 Tuesday, May 15, 2001 11:06 AM

484 Index

Programmatic authentication, 271-81 required element, , 18 enforceLogin tag, 272-73 Resin, 263, 264-66 pros/cons, 271 AbstractAuthenticator class, 266 PropertyResourceBundle, 221 Authenticator interface, 264 Property resource bundles, 221 default authenticator, 264 protected-page attribute, Resource bundles, 213-24 enforceLogin tag, 272-73 defined, 214 /protected-page.jsp, 257, 265 keys, 214 /protectedPage.jsp, 275 using constants for, 219-20 PurchaseAction.java, 414 list, 215-19 PutTag class, 122, 128-30 multiple, 221-24 property, 221 Q ResourcePool class, 306-14 Resources_fr.java, 216 QueryAccountAction class, 193, 447-48, with constant keys, 220 464 Resources_fr.properties, 221 query-account-page, 450 Resources.java, 215, 220 Query class, 292-93 Resources.properties, 221 query tag, 4, 284, 289-93, 303, 320 role attribute, region:render tag, 107-8 id attribute, 288 Role-based content, 106-8 scope attribute, 288 role-name element, tag handler for, 290-91 , 270 QueryTag.java, 290-91 Roles, 252-54 rows tag, 4, 284, 299-301, 320 R RowsTag.java, 299-300, 327-29 rtexprvalue attribute Radio buttons, 62-65 element, < >, 18 RadioElement class, 84, 87 RealmBase abstract class, 267 S RealmBase methods, Tomcat 4.0, 267-69 SAX2, 341 region:define tag, 110, 122, 130 SAXElement.java, 343-44, 346, 354 region:put tags, 101, 108, 110, 114, 130 SAXParserBean.java, 342-43, 346-47 region:render tag, 101-2, 107, 110, 122, SAXParserTagInfo.java, 352 130 SAXParserTag.java, 350-52 Region class, 116-17, 120-21 SAX (Simple API for XML), 351-54 /regionDefinitions.jsp, 109, 111, callbacks, 341 397-98 compared to DOM, 341 /regionDefinitions-override.jsp, custom tags, 346-54 113, 115 defined, 341 RegionDefinitionTag class, 122, 125-26 handler interfaces, 341 Regions, 100-103, 108-10 process, 342 defined, 98 using, 344 extending, 112-14 with JSP custom tags, 347 nesting, 110-12 scope attribute, query tag, 288, 291 RegionStack class, 116, 121-22 Scripting variables, 41-46 RegionTag class, 122-25 associating a tag handler and, 43-44 release method, Tag interface, 8, 12-13, compared to beans, 44 25 custom tag IDs, using, 44-46 release tag, 284, 289, 301, 303 defined, 41 ReleaseTag.java, 301 information, specifying, 42-43 remove-session-token tag, 203 storing beans in page scope, 42 RenderTag class, 122, 126-28 ScrollBean.java, 326-27 requestParameter tag, 16, 18 Scrolling through result sets, 324-29 index.fm Page 485 Tuesday, May 15, 2001 11:06 AM

Index 485

/scrollQuery.jsp, 325-26 ServletRequest getRequest() Section class, 116-19 method, PageContext, 21 Sections, 100-103 ServletResponse getResponse() defined, 98 method, PageContext, 21 Secure sockets layer (SSL), and client Servlet Specification, 141fn certificate authentication, 263 setCategory bean method, 78 security:showErrors tag, 281 setCollection method, 38 Security, 250-81 setProperty tag, 89 basic authentication, 256-59 SetupServlet.java, 304, 435-37 client certificate authentication, 263 Shopping cart, online fruitstand, 406-10 customizing authentication, 263-69 ShoppingCart.java, 425-26 digest authentication, 259-60 SHOPPING_CART_KEY, 426 form-based authentication, 260-63 SHORT constant, DateFormat class, 225 programmatic authentication, 271-81 shortname element, , 11 servlet authentication, 251-55 showApi.jsp, 55 principals, 252-54 showCustomerQuery.jasp, 288-89 roles, 252-54 showErrorsTag.java, 281 Web application security elements, showForm.jsp, 64, 68 269-71 ShowHintAction.java, 172-73 elements, 269 ShowHintAction.jsp, 173-74 SelectableElement interface, 87 /showMessage.jsp, 218, 219, 232 selectNodes custom tag, 386 /showParams.jsp, 180 select tag, HTML, 54-56, 65, 93 /showPreparedStatementQuery.jsp, SensitiveActionListener, 196-98 316-17 Sensitive form resubmissions, 190-205 /showRequestParameters.jsp, 178 and online fruitstand case study, 464-65 /show-security.jsp, 257 tokens as used by listener, 194-98 /sidebar.jsp, 105, 400 trapping: online fruitstand, 404 SIDEBAR REGION diligence in, 201 _ , 109-12, 114, 116 SimpleAuthenticator.java with a Model 2 framework, 191-94 , 266 SKIP_BODY without a framework, 201-4 , 10, 13, 26, 29, 38-39, 177 Server-side validation: SSL, and online fruitstand case study, 465-66 static findAncestorWithClass with JSP, 72-73 method, TagSupport class, 57 with servlets, 73-75 Storefront, online fruitstand, 402-6 Server side validation, with servlets and JSP STOREFRONT_REGION pages, 75-77 , 398, 429 Servlet authentication, 251-55 Strategy design pattern, 97 StreamToFileTag.java, 340 declarative authentication, 254 StringArrayElement class, 85-87 portability, 254-55 StringElement class, 85-87 principals, 252-54 String getAuthType(), 254 roles, 252-54 String getPassword(String user), types of authentication, 255 267 Servlet container, 183, 472 String getRemoteUser(), 253 ServletContext String getScheme(), 254 getServletContext() Swing XML viewer, 354-55 method, PageContext, 21 Servlet filters, 471-75 defined, 471 T example, 473-75 table tags, HTML, 99-100 how they work, 472 , 7, 11-12 ServletRequest.getParameter, 16 elements, 12 index.fm Page 486 Tuesday, May 15, 2001 11:06 AM

486 Index

Tag attributes, 12 /test.jsp, 6, 217, 231-32, 235-36, 288, properties, 20 339-40 , 7 /test_preparedStatements.jsp, tagclass element, , 12 315-16 tagdependent, 12 /test_sax.jsp, 345-47, 348-50 tag element, , 11 /test_scroll.jsp, 325 TagExtraInfo, 41-42 /test_transaction.jsp, 321 tag handlers, 7-10 test_xpath.jsp, 385-86 body, 27 /test_xsit.jsp, 379 error handling, 22-23 TextAreaElement class, 86 from regions custom tag library, 122-30 Text areas, 62-65 properties, 20 TextElement class, 84, 86 Tag instances, lifetime of, 13-14 Textfields, 62-65 Tag interface, 7-8, 25-26 this.form.submit(), 56 doEndTag method, 8, 12 title content, 102 doStartTag method, 8, 12 tlibversion element, , 11 release method, 8, 12-13, 25 Token class, 195 , 7, 11-12 token custom tag, 202-3 elements, 11 tokens:token custom tag, 464 taglib directive, 6, 10 Tokens: Tag Library Descriptor (TLD), 6-7, 347 defined, 194 Tag life cycle, 12-13 as used by listener, 194-98 Tag package, 23-24 as used by programmer, 199-201 tags.CounterTag, 10 TokenTag class, 200-201 TagSupport class, 20, 26-27, 122 Tomcat 3.2.1 Final, 332 static findAncestorWithClass Tomcat 4.0, 262, 267-69, 332 method, 57 custom realm, 267 teiclass element: RealmBase abstract methods, 267-69 , 43 tomcat-users.xml, 269 tomcat-user.xml , 12 , 258-59 Templates, 96-130 Transactions, 320-24 combining extended and nested regions, defined, 320 transaction 114-16 tag, 284, 320-21 TransactionTag.java defined, 98 , 322-24 encapsulating layout, 98-103 Transmission of form data, 62 transport-guarantee optional content, 103-6 element, regions, 100-103, 108-10 , defining separately, 108-10 270 extending, 112-14 nesting, 110-12 U region tag implementations, 116-30 Unicode, 208-9 beans, 116-22 escape sequences, 208-9 tag handlers, 122-30 alternative to, 209 role-based content, 106-8 Universal Character Set (UCS), 211 sections, 100-103 update attribute, query tag, 291 using to implement Web applications UpdateLocateAction.java, 442-43 with modular components, 103 UpdatePricesTag.java, 367-69 Template text, 331fn uri element, , 11 /test_dom_books.jsp, 357-60 url-pattern element, test_dom_books_with_tags.jsp, , 364-65 270 test.html, 179 useBean tag, 39 index.fm Page 487 Tuesday, May 15, 2001 11:06 AM

Index 487

Use cases, 142 online fruitstand, 395-96, 433-34 adding, 171-75 welcome.jsp, 28, 146 online fruitstand, 393-94 Window toolkits, 97 User class, 138-39, 146, 421-22 WML (Wireless MetaLanguage), 331 , 269 elements, 270 X Users class, 422-24 util:token custom tag, 200-201 XML, 330-89 defined, 3 V generating, 333-39 with beans, 334-38 ValidateAccountAction.java , 450, with JSP, 331 459-60 specifying a content type of text/xml, validate-account.jsp , 449-50, 459 336 ValidatedElement interface, 85, 90 generating beans from, 338-39 validate.jsp, 73, 89 manipulating, 331 Validation, 69-77 and online fruitstand case study, 466-68 client-side: parsing, 332, 341-74 implementing, 75 with JavaScript, 69-72 Document Object Model (DOM), server-side: 354-74 implementing, 75 SAX (Simple API for XML), 351-54 with JSP, 72-73 postprocessing, 339-41 with servlets, 73-75 tags, data represented by, 3 server side, with servlets and JSP pages, transforming, 374-89 75-77 usefulness of format, 384 VariableInfo constants, 43 XML Productivity Kit, 338 void forward(String path) method, XPath, 384-89 PageContext, 21 custom tags, using, 385 void include(String path) method, defined, 384-85 PageContext, 21 XPathBean class, 388-89 void removeAttribute(String) XPathTag.java, 386-87 method, PageContext, 21 xsl:apply-templates, 376 void setAttribute(String, XSLT: Object) method, PageContext, actions, 376 21 defined, 374, 376 patterns, 376 W purpose of, 374 Web application security elements, 269-71 template rules as basis of, 376 Web components, use of term, 98 using at compile time vs. runtime, 384 Web page development, See Design using in a custom tag to produce HTML, , 269 377-81 elements, 270 using with JSP, 376-77 web-resource-name element, using to produce JSP at compile time, , 382-84 270 using to transform XML into HTML, 375 web.xml, 141-42, 258, 262-63, 265-66, XSLTApplyTag.java, 380-81 277-78, 473-74 XsltProcessorBean.java, 381