jsp.book Page Friday, March 17, 2000 2:32 PM Web Development with JavaServer Pages jsp.book Page Friday, March 17, 2000 2:32 PM jsp.book Page Friday, March 17, 2000 2:32 PM Web Development with JavaServer Pages DUANE K FIELDS MARK A KOLB MANNING Greenwich (74° w long.) jsp.book Page Friday, March 17, 2000 2:32 PM For online information and ordering of this and other Manning books, go to www.manning.com The publisher offers discounts on this book when ordered in quantity For more information, please contact: Special Sales Department Manning Publications Co 32 Lafayette Place Greenwich, CT 06830 Fax: (203) 661-9018 email: orders@manning.com ©2000 by Manning Publications Co All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end Library of Congress Cataloging-in-Publication Data Manning Publications Co 32 Lafayette Place Greenwich, CT 06830 Copyeditor: Elizabeth Martin Typesetter: Tony Roberts Cover designer: Leslie Haimes Printed in the United States of America 10 – CM – 03 02 01 00 jsp.book Page Friday, March 17, 2000 2:32 PM To Kris— for her patience, encouragement and good humor that made this project possible D.K.F For Megan, Andrew, and Jean— your presence is my strength, and your love my inspiration M.A.K jsp.book Page Friday, March 17, 2000 2:32 PM jsp.book Page vii Friday, March 17, 2000 2:32 PM brief contents ■ Introduction ■ Fundamentals 21 ■ Programming JSP scripts ■ Actions and implicit objects 84 ■ Using JSP components 111 ■ Developing JSP components 147 ■ Working with databases 178 ■ Architecting JSP applications 209 ■ An example JSP project 10 ■ Deploying JSP applications 297 11 ■ Performing common JSP tasks 321 12 ■ JSP by example 366 13 ■ Creating custom tags 403 14 ■ Implementing advanced custom tags 436 49 250 jsp.book Page viii Friday, March 17, 2000 2:32 PM viii BR I E F C O NT E N T S A ■ Running the reference implementation 477 B ■ Incorporating Java applets 489 C ■ JSP resources 503 D ■ JSP syntax reference 508 E ■ JSP API reference 524 index 545 jsp.book Page ix Friday, March 17, 2000 2:32 PM contents preface xix acknowledgments xxi about this book xxiii about the authors xxvii author online xxviii about the cover illustration Introduction xxix 1.1 What is JSP? 1.2 Evolution of dynamic content technologies Common Gateway Interface ColdFusion Active Server Pages Server-Side JavaScript PHP Java servlets JavaServer Pages ■ ■ ■ 1.3 ■ JSP and Java Enterprise Edition 10 Java platform editions 11 Web-based applications 11 ■ 1.4 JSP benefits 13 Performance 13 Reusable components 16 Separating presentation and implementation 17 Achieving division of labor 19 ■ jsp.book Page x Friday, March 17, 2000 2:32 PM x CO N TE NT S Fundamentals 21 2.1 Writing your first JSP 22 About the examples 22 Hello, World! 22 Hello, World! revisited 23 Hello, World! the Bean edition 25 Hello Real World 27 ■ ■ ■ 2.2 2.3 Tag conventions 28 Scripting-oriented tags 29 ■ XML-based tags 29 Running JSP 31 Adding JSP support 32 How JSPs work 33 Buffered output 38 Session management 40 Scalability 43 Error handling 46 ■ ■ ■ Programming JSP scripts 49 3.1 Scripting languages 50 3.2 JSP tags 3.3 JSP directives 52 Page directive 52 Include directive 63 Tag library directive 65 52 ■ 3.4 Scripting elements 67 Declarations 67 Expressions 71 ■ 3.5 ■ Scriptlets 74 Flow of control 76 Conditionalization 76 Iteration 77 handling 77 A word of caution 80 ■ ■ Exception ■ 3.6 Comments 81 Content comments 81 JSP comments 81 Scripting language comments 82 ■ jsp.book Page 540 Friday, March 17, 2000 2:32 PM Package javax.servlet.jsp.tagext public String getString () public void writeOut (java.io.Writer writer) throws java.io.IOException E.5.2 Interface BodyTag Inheritance Extends Tag Constructors No public constructors or factory methods Class variables public static final int EVAL_BODY_TAG; Methods public int doAfterBody ()throws javax.servlet.jsp.JspException public void doInitBody () throws javax.servlet.jsp.JspException public void setBodyContent (BodyContent content) E.5.3 Class BodyTagSupport Inheritance Extends TagSupport, implements BodyTag Constructors public BodyTagSupport () Methods public public public public public public public E.5.4 int doAfterBody ()throws javax.servlet.jsp.JspException void doEndTag () throws javax.servlet.jsp.JspException void doInitBody () BodyContent getBodyContent () javax.servlet.jsp.JspWriter getPreviousOut () void release () void setBodyContent (BodyContent content) Interface Tag Constructors No public constructors or factory methods Class variables public static final int EVAL_BODY_INCLUDE; public static final int EVAL_PAGE; 540 jsp.book Page 541 Friday, March 17, 2000 2:32 PM 541 APPENDIX E JSP API reference public static final int SKIP_BODY; public static final int SKIP_PAGE; Methods public public public public public public E.5.5 int doEndTag ()throws javax.servlet.jsp.JspException int doStartTag () throws javax.servlet.jsp.JspException Tag getParent () void release () void setPageContext (javax.servlet.jsp.PageContext context) void setParent (Tag parent) Class TagAttributeInfo Constructors No public constructors or factory methods Class Methods public static TagAttributeInfo getIdAttribute (TagAttributeInfo[] array) Methods public public public public E.5.6 boolean canBeRequestTime () String getName () String getTypeName () boolean isRequired () Class TagData Inheritance Implements Cloneable Constructors public TagData (Object[][] attributes) public TagData (java.util.Hashtable attributes) Methods public public public public public E.5.7 Object clone () Object getAttribute (String name) String getAttributeString (String name) String getId () void setAttribute (String name, Object value) Class TagExtraInfo Constructors public TagExtraInfo () jsp.book Page 542 Friday, March 17, 2000 2:32 PM Package javax.servlet.jsp.tagext Methods public public public public E.5.8 TagInfo getTagInfo () VariableInfo[] getVariableInfo (TagData data) boolean isValid (TagData data) void setTagInfo (TagInfo info) Class TagInfo Constructors No public constructors or factory methods Class variables public static String BODY_CONTENT_EMPTY; public static String BODY_CONTENT_JSP; public static String BODY_CONTENT_TAG_DEPENDENT; Methods public public public public public public public public public E.5.9 TagAttributeInfo[] getAttributes () String getBodyContent () String getInfoString () String getTagClassName () TagExtraInfo getTagExtraInfo () TagLibraryInfo getTagLibrary () String getTagName () VariableInfo getVariableInfo (TagData data) boolean isValid (TagData data) Class TagLibraryInfo Inheritance This is an abstract class Constructors No public constructors or factory methods Methods public public public public public public public public String getInfoString () String getPrefixString () String getReliableURN () String getRequiredVersion () String getShortname () TagInfo getTag (String shortname) TagInfo[] getTags () String getURI () 542 jsp.book Page 543 Friday, March 17, 2000 2:32 PM 543 APPENDIX E JSP API reference E.5.10 Class TagSupport Inheritance Implements Tag, java.io.Serializable Constructors public TagSupport () Class methods public static Tag findAncestorWithClass (Tag from, Class klass) Methods public public public public public public public public public public public public void doEndTag () throws javax.servlet.jsp.JspException void doStartTag () throws javax.servlet.jsp.JspException Tag getParent () String getTagId () Object getValue (String name) java.util.Enumeration getValues () void release () void removeValue (String name) void setPageContext (javax.servlet.jsp.PageContext context) void setParent (Tag parent) void setTagId (String id) void setValue (String name, Object value) E.5.11 Class VariableInfo Constructors public VariableInfo (String variableName, String className, boolean declare, int scope) Class variables public static int AT_BEGIN; public static int AT_END; public static int NESTED; Methods public public public public String getClassName () boolean getDeclare () int getScope () String getVarName () jsp.book Page 544 Friday, March 17, 2000 2:32 PM jsp.book Page 545 Friday, March 17, 2000 2:32 PM index Symbols See include directive See page directive 492, 519 411, 423 305 411, 427 317, 318 308 308 309 491 308 409, 411 310 349, 351–352 491, 495 59–89, 100, 104, 108, 140–141, 330, 515 26, 110, 128–129, 159, 437, 450, 458, 460, 470, 474, 516 65, 89, 100, 106, 108, 140–141, 216, 218, 324, 517 106, 494, 496, 515, 517, 519 495, 519 57, 110, 491, 518 26, 110, 130–131, 136, 139, 159, 437, 450, 458, 470, 473–474, 521 wild card 135, 388 25, 110, 124, 127, 132, 133, 173, 437, 450, 451, 460, 470, 473–474, 516, 522 type attribute 146 313 409 308 310, 313 316 410–411 491 351 494 310 310 412 412 351 309, 312 310 311 310, 312 317 317 409 308 409–410 410 315, 409, 476 315 315 410, 416, 450, 475 350 409 410 312 308 309 _jspService() 76 A absolute URLs 304 abstraction 112 545 jsp.book Page 546 Friday, March 17, 2000 2:32 PM 546 INDEX accessor methods 150–151, 154 getter method 150, 153 setter method 150, 153 actions 52, 85, 104 Active Server Pages 5, 6, 9, 15–16, 28 ActiveX 6, 16 addCookie() 322, 324 Apache web server 7, 9, 10, 32–33, 45–46, 478, 506 modules 32 applets 3, 489, 495 application Beans 144 application flow 211–212, 225 application implicit object 97, 105, 298, 362 application initialization parameters 319 application logic 210–211, 243, 265 application scope 102, 144 application server 12, 242, 505 architecture 213 multitier 241 page-centric 213, 247 requirements 246 servlet-centric 213, 243 architecture multitier 244 ASP See Active Server Pages attribute scope 102 attributes 101 authentication 175, 224 autocommit 197, 203 autoFlush attribute 60, 63, 324 availability 246 AWT 489 B back button 212, 229, 270 BannerBean 367 base name, Java classes 57 BeanInfo 169, 414, 452, 466 beanName attribute 171 Beans See JavaBeans Blue Cookie Page 326 BodyContent 415, 430, 450, 458, 462, 539 BodyTag 412, 428, 439, 459, 540 BodyTagSupport 412, 422, 429, 432, 439, 459, 540 bookmarking 213 boolean properties 158, 160 bound properties 172 Bradley, Alan 26 buffer attribute 59, 60 buffered output 38, 39, 59, 60 See also output buffering BufferedReader 364 C C preprocessor 64 CachedRowSet 193 caching 142, 145 prevention 91 CGI scripting 3, 7, 13–15, 34, 104, 106, 108, 110, 363 character set 55 checked keyword 351, 352 class methods 70 class path 33, 35, 306 class variables 68 clearBody() 429, 462 Colburn, Rafe 215 ColdFusion 5, 9–10, 16, 179, 180 color bars 397 command pattern 227, 243, 265 CommandToken 270 comments 52, 81, 508 commit() 197 Common Gateway Interface See CGI scripting compilation error 46, 75, 83, 97, 420 component-centric design 112 components 16 architecture 112–113, 218 development 113, 122 model 112 persistence 142 composite pages 216 compound interest calculator 134 CompoundInterestBean 165, 168 conditionalization 76, 80, 449 tertiary operator 73 conference booking tool 197 config implicit object 87, 99 configuring Beans 161 connection pool 189 ConnectionBean 189, 199 constrained properties 172 content comments 81, 508 content types 55, 316–317, 336 contentType attribute 55, 316, 364, 399 control layer 210–212 jsp.book Page 547 Friday, March 17, 2000 2:32 PM INDEX cookies 38, 41, 51, 59, 89, 108, 110, 322, 334, 344, 423, 424, 427, 430, 530 restrictions 328 CORBA 16 CountDown applet 496 custom tags 10, 18, 50, 52, 65, 80, 104, 123, 157, 363, 404, 437, 513 API 412 attributes 407 body content 415 hierarchy 438 interaction 437 libraries 315, 504 nested 430 validation 416 doAfterBody() 416, 428, 432, 462 Document Type Definition 308 doEndTag() 414, 416, 422, 424 doGet() 34 doInitBody() 415 doPost() 34 doStartTag() 414, 421–423, 447–448, 451, 460 Drumbeat 2000 12, 506 DTD See Document Type Definition dynamic content dynamic HTML 9, 344 dynamically generating property values 153 D EJBs See Enterprise JavaBeans electronic mail 335–336, 374 JavaMail 330, 335, 376, 405 Element Construction Set (ECS) email See electronic mail embedding tags 31 encodeHTML 432 EncodeHtmlTag 432 encodeURL() 429 Enterprise JavaBeans 11, 241, 247–248, 478 and Javabeans 241 EJB container 242, 317 error handling 46, 77, 207, 230, 317 servlets 230 error page 62, 103, 108, 329 errorPage attribute 59, 63, 64, 77, 317, 329 EVAL_BODY_INCLUDE 448 EVAL_BODY_TAG 414, 416, 463 example tag library 419 exception implicit object 63, 103, 329, 331, 338, 525 expressions 67, 71 extends attribute 55, 87 Extensible Markup Language See XML extranet 245 data Beans 121, 248 data sources 180 databases 15, 70, 231, 242 access 197 database-driven JSPs 182 handling large sets of results 191 handling nulls 187 java.sql package 179 persistent connections 188 persistent ResultSet 191 prepared statements 181, 261–262 type conversion 185 DataBean 471, 474 dates and times from a database 186 DebugBufferTag 420 DebugCookiesTag 423 declarations 67, 469, 510 method 69 variable 67 declare flag 418 deployment descriptor 88, 97, 99, 299–300, 302–303, 307, 308 deploytool 301 deprecated methods 524 directives 52 distributed architectures 241 transactions 246 web applications 44, 309 division of labor 19, 114, 116, 248 DMZ 244, 246, 253 E F fact() 69, 72, 76–77, 81–82, 89 factorial 69 factory method 524 factory pattern 524 FAQ 504 FaqBean 254 547 jsp.book Page 548 Friday, March 17, 2000 2:32 PM 548 INDEX FaqRepository 257 FaqRepositoryException 263 FaqServlet 290 FetchEmployeeServlet 235 findAncestorWithClass() 439, 443–444 findParentWithClass() 448 firewall 244 flow control 76, 219, 224, 266 Flynn, Kevin 24, 54, 74, 514 for loop 77 form processing persistent interfaces 350 FormBean 357 forms handling 133, 137, 275, 344, 356 persistent interfaces 349–350, 389 submission 137 forProperty 450, 458 ForPropertyTag 459 ForPropertyTEI 468 G GameGrid 74 getAttribute() 220, 223, 226 getAttributeString() 470 getClass() 460 getContextPath() 305 getCookies() 322, 324 getId() 470 getIndexedReader() 465 getInitParameter() 319 getLastAccessedTime() 144 getMaxInactiveInterval() 43, 144 getMimeType() 397 getPageContext() 398 getParam() 345 getParameter() 495 getParamValues() 345 getParent() 438–439 getPathInfo() 226, 312 getPreviousOut() 429, 462 getReader() 465 getRequestDispatcher() 90, 221 getRequestURL() 196, 223, 332 getResource() 306 getResourceAsStream() 306 getServletPath() 223 getString() 429 getter method 150, 153 getVariableInfo() 416, 469, 470 Gregg, Preston 231 H headers 38, 59, 110 Hello, World! 22, 25 HelloBean 25, 488 helper class 407–408, 416–417, 458, 463, 468 naming convention 469 Hewlett Packard 504 hidden form elements 226, 349 HomeSite 12, 506 HTML encoding 431 entity 350, 431 tags 304 HTTP 2, 38–40, 43, 56, 322, 325, 344 GET 23, 26, 34, 332 headers 89, 108 POST 23, 34 protocol 212 HTTP server 32–36, 478, 483 HttpJspPage 87, 314, 535 HTTPS 325 HttpServletRequest 89, 305, 322, 332–333, 531 HttpServletResponse 90, 322, 532 HttpSession 43, 95, 144, 534 HttpSessionBindingEvent 171 HttpSessionBindingListener 96, 171, 191–192, 534 HttpUtils 196, 332 HyperText Transport Protocol See HTTP I IBM 477, 503 if statement 76 ifProperty 450 IfPropertyTag 450 IllegalArgumentException 78 IllegalStateException 107 implicit object 42, 86, 176, 398, 422 attributes 86, 89, 95, 97, 99, 105 import attribute 53, 56, 338, 512 import statement 56 in process 15 include directive 55, 63–64, 67, 99, 110, 216, 511, 518 index generator 391 jsp.book Page 549 Friday, March 17, 2000 2:32 PM INDEX indexed properties 119, 132, 154–156, 174, 383, 463, 471 accessing through Bean tags 157 InetAddress 343 info attribute 54 inheritance 524 initialization parameters 87, 97, 99 initializing Beans 132 from request 133 properties 138 instance variables 68, 152, 166 Internet Assigned Numbers Authority (IANA) 55, 316 Internet Information Server (IIS) 6, 32 Internet Server Application Programming Interface (ISAPI) 32 intranet 244–245 introspection 149, 452, 458, 461–462, 465, 470, 475 IntrospectionException 454, 466 introspector 452 invoke() 468 IP address 340 iPlanet 15, 506 isChecked() 346 isErrorPage attribute 63, 103, 338, 525 ISO-8859-1 character set 55 isSelected() 346 isThreadSafe attribute 68 isValid() 416, 469, 470 iteration 76–77, 80, 449, 458 J Jakarta 10, 33, 477–478 JARs 406, 475 jar command 307 JAR files 298, 306, 484 Java 489 Enterprise Edition (J2EE) 11–12, 302, 308, 505 Micro Edition (J2ME) 11 Standard Edition (J2SE) 11 Java Community Process 30 Java Development Kit See JDK Java plug-in 110, 490 Java Runtime Environment See JRE Java servlets See servlets Java Virtual Machine See JVM Java Web Server 32 549 java.sql package 179 JAVA_HOME environment variable 480–482 JavaBeans 12, 16, 18, 20, 25, 50, 52, 72, 76, 110, 112, 117, 183, 404–405, 413, 466 accessibility 139 and EJBs 241 API 117, 148, 172 Bean containers 117 configuring 145, 161 constructors 161 containers 117, 119, 148 conventions 148 creating 147 data Beans 121 data types 119 defining properties 150 event model 172 from a database 182 indexed property 458 initializing 132, 133, 137 initializing from the request 133 interfaces 169 life span 139, 175 persisting 182–185 properties 117 property sheets 120 removing from scope 175 scope 139 self populating from a database 184 serialized 170 service Beans 121 visual 121 JavaMail 330, 335, 376, 405 See also electronic mail JavaScript 6, 51, 115, 275, 277, 340, 355, 401, 505 cross-frame 342 generating with JSP 340 onChange() handler 342 onKeyPress() handler 344 onSubmit() handler 355 javax.sql 179 JDBC 179, 197, 231, 405, 411 data types 185 JDBC 2.0 180, 191, 193 JDK 478, 503 Jedi training 214 Jigsaw 32 JMeter 46, 506 JNDI 180, 261 jsp.book Page 550 Friday, March 17, 2000 2:32 PM 550 INDEX JRE 11, 480–481, 483, 493 JRun 10, 505 Jscript JServ 479 JSP application 144–145 Bean tags 122 comments 81 components 182 container 14, 32–33, 35, 40, 52, 54, 56, 302, 304, 310, 505 version information 99 engine 14 JSP 1.1 524 life-cycle methods 70 jspDestroy() 70 JspException 230, 422, 461, 536 jspInit() 70, 88 JSP-INTEREST 507 JspPage 87, 536 JspTagException 422, 466, 468 JspWriter 92, 415, 537 JVM 13–15, 38, 42, 490 session management 45 L life span 139 life-cycle events 70 linked properties 118–119 Linux 7, 9, 478–479, 503 load balancing 42, 44–45 log files 48, 97 looping See iteration Lora 349, 487 M mail See electronic mail maintenance 247 makeErrorReport() 331 MANIFEST.MF 406 Manning utility tags 419, 475–476 MD5 270 mediator pattern 219, 265 message digest 230 META-INF directory 406 Microsoft 490, 503 Internet Explorer 47, 489, 491, 493 Internet Information Server (IIS) Microsoft continued Windows 6, 11, 340, 478, 482, 490, 503 Windows NT MIME types 55, 316, 317, 336 setContentType() 316 text/html 316 modification date 362 multipage transaction processing 197 multi-threading 7, 14, 34, 43, 61 See also isThreadSafe attribute thread safety 61, 68 multitier architectures 241, 244 multivalued properties See indexed properties N NamedRequestDispatcher 224 namespaces 30 nclude 63 Netscape Application Server 7, 12, 32, 242 Communicator 340, 489, 491, 493 Enterprise Server 7, 32 NSAPI 32 null values 160 NumberFormat 422 O Object 87, 99, 460 Object Management Group (OMG) 16 onChange() handler 342 onKeyPress() handler 344 onSubmit() handler 355 Open Source 5, 7, 9, 32, 46, 476, 477, 503, 505, 506 out implicit object 92, 416 outline 440 OutlineBase 443 OutlineItemTag 441 OutlineTag 441 output buffer 38–40, 60, 107, 110, 324 buffer size 59 clearing 94 default size 40, 59 error pages 63 flushing 94, 107–108 size parameters 93 jsp.book Page 551 Friday, March 17, 2000 2:32 PM INDEX P Q packages 56, 58, 125 page Beans 140 page compiler servlet 35–36, 39, 312, 314, 407 page directive 52–54, 68, 77, 87, 97, 103, 125, 316–317, 324, 329, 330, 338, 364, 437, 512, 525 page implicit object 87, 525 page scope 102 page-centric design 213, 247 limitations 218 PageContext 417, 538 implicit object 99, 100, 105, 281 instance variable 422, 424, 429, 438, 451, 461, 463 page-to-page communication 273 performance 13, 246 testing 45 Perl 3, 6, 15 PerlScript persistence 242 long term 170 persistent connections 188 persistent ResultSet 191 PHP 5, 7, 9, 16, 179 PKG 480 PlotBean 471 port number 483 POST 332 precompiling JSP pages 37, 299 prepared statements 181, 261–262 presentation layer 210–211 PrintWriter 92, 331 productivity 17, 20 properties 117, 150 data types 119 handling null values 160 indexed 119 linked 118 name conventions 153 read-only, write-only 118 property descriptors 466 property sheets 120 PropertyDescriptor 453 PropertyVetoException 172 public web 244 quote generator 370 551 R radio buttons 350 read-only property 153 Recognizer 74 Red Cookie Page 324 Redhat Package Manager 479 reference implementation.See Tomcat reflection 149, 452, 453, 458, 461, 463, 467, 475 relative URL 304 release() 414, 423, 424, 444, 446, 451, 454, 463 reloading a page 212, 229, 270 removing a Bean 175 reportCookies() 334 reportException() 331 reportHeaders() 333 reporting system problems 340 reportParameters() 333 reportRequest() 331 request 34, 35, 351 attributes 86, 89, 141, 221–223, 225, 230, 349, 526 Beans 141 headers 38, 322, 333 implicit object 23, 88, 105, 176, 322, 326, 330, 345, 349, 362 parameters 23, 51, 89, 105–106, 109, 133, 137–138, 226, 333, 345, 350–352, 354, 357 scope 102 spoofing 138 requestContains() 346 RequestDispatcher 221–222, 225, 230, 349, 526 forward() 222 include() 222 request-time attribute values 31, 105–106, 108, 412, 496, 515, 517, 521 Resin 51, 505 resource pooling 11, 408, 412, 414, 416 response 34–35 body 38, 40 headers 38–40, 60–61, 94, 322, 324 implicit object 90, 322, 324 ResultSet 183, 192 persistent 191 reusability 16–17, 26, 112–113 jsp.book Page 552 Friday, March 17, 2000 2:32 PM 552 INDEX risk factors 247 role-based pages 213 rollback() 197 rotating banner ad 367 RPM See Redhat Package Manager run-time errors 47, 59 S scalability 5, 43, 246 scope 75, 101, 146, 175, 418 application 102 of JavaBeans 139 page 140 request 141 session 102 screen mapper 225 scripting elements 50, 52, 55, 85 language 50, 64, 67, 72, 87, 463 comments 82 tags 27, 28, 29 variables 407, 417, 458, 462–463, 468–469 scriptlets 67, 74, 76, 82, 520 and JavaBeans 173 security 138, 175 selected keyword 351 self-populating Beans 184 sendEmail() 335 sending mail See electronic mail separation of presentation from implementation 26 serialization 42, 246 serializable interface 170 Server Side JavaScript 179 server.xml 299, 486, 487 Server-Side JavaScript (SSJS) 5–6, 9, 16 service Beans 121 servlet-centric design 213, 243 ServletConfig 88 ServletContext 97, 222, 298, 318–319, 527 ServletExec 505 ServletKiller 46, 507 ServletRequest 89, 528 ServletResponse 90, 529 servlets 7, 10, 12, 14, 34, 82, 87, 104, 106, 108, 110, 141, 213, 219–226, 230, 243, 247–248, 299, 309, 312, 349, 524, 526 container 14, 34 version information 99 servlets continued engine 14 error handling 230 errors 329 mapping 311 request attributes 225, 230, 349, 526 RequestDispatcher 224 scalability 43 Servlet API 2.1 221 Servlet API 2.2 141, 221 with JSP 219, 265 session 246, 318 attribute 54, 58, 97, 525 Beans 142 events 171 expiration 43 ID 428, 430 implicit object 42–43, 58, 95, 103, 105 load distribution 44 management 6, 40, 41–42, 51, 58, 95, 97, 102, 105, 142, 427 migration 45 scope 102 timeout 96 setAttribute() 223 setBodyContent() 415 setContentType() 316 setMaxAge() 324 setMaxInactiveInterval() 43, 144, 318 setPageContext() 413, 422 setParent() 413, 438, 447 setter method 150, 153 shopping cart 142, 170 singleton pattern 257, 261 SKIP_BODY 414 SMTP 335–336 socket connections 380 Solaris 478, 480, 490, 503 SQL 181, 196, 232, 411 SQLException 263 stack trace 47, 329, 331, 340 startsWithVowel() 69 static methods 70 static variables 68 sticker 372 sticky widgets 344, 388 StringBuffer 331, 433 StringWriter 331 Submit buttons 352 Sun Microsystems 3, 7, 10, 16, 33, 477, 490, 503 jsp.book Page 553 Friday, March 17, 2000 2:32 PM INDEX superclass 55 Swing 489 Swinglets synchronized keyword 62, 262 system commands 363 T tag 412, 421, 439, 540 tag constants EVAL_BODY_INCLUDE 414, 451 EVAL_PAGE 414, 422 REQUEST_TIME_VALUE 417 SKIP_BODY 414, 416, 451, 461, 463 SKIP_PAGE 414 tag handler 407, 412, 475 naming convention 420 reuse 408 tag library 30, 307, 405, 419 descriptor 66, 315, 405, 408, 416, 419, 427, 440, 449, 468, 470, 475, 513 versioning 409 TagAttributeInfo 418, 541 TagData 416, 470 TagExtraInfo 410, 416, 469, 541 TagInfo 418, 542 taglib directive 65, 315, 404–405, 476, 513 taglib.tld 406, 475 TagLibraryInfo 418, 542 TagLibraryInfoImpl 484 TagSupport 412, 421–422, 439, 443, 447, 543 team size 248 TEI 469 See also TagExtraInfo Tell a Friend! sticker 372 template systems text areas 350, 389 text field 349 threading See multi-threading throwable 103, 338 time-out 43 TimerBean 143 timestamp 186, 263 TLD See tag library, descriptor Tomcat 33, 299, 477, 478, 505 toString() 72 touch 65 transaction 196, 198, 212 integrity 229, 247, 269 management 11, 241 monitors 242 processing 196–197 support 242 token 229 transferring control 99, 104, 108 trigger properties 118, 185 try block 77, 79, 329, 339 tutorial 504 type conversion 119, 159 U UNIX 6, 7, 65, 92, 363 time 92 UnknownFaqException 263 URL 427 absolute 304 length 23 mapping 299, 304, 311 relative 304 rewriting 41, 427, 478 URLDecoder 328 usability 20 user authentication 175 V validation 407 client-side 355 server-side 355–356 valueBound() 171 valueUnbound() 171 VariableInfo 417, 469 VariableInfo constants AT_BEGIN 418 AT_END 418 NESTED 418, 470 VBScript View Source 24, 81, 398 virtual private networks 245 visibility 418 Visual Age for Java 12 Visual Basic visual component Beans 120–121 VPN See Virtual Private Network W WAR See web archive 553 jsp.book Page 554 Friday, March 17, 2000 2:32 PM 554 INDEX wasNull() 187 Watchdog 479 web 300 web application deployment descriptor See deployment descriptor web application server 12, 32 web applications 210 from component 115 web archive 37, 298 317 308 308 309 308 310 308 310 310 310 312 310 311 310, 312 317 317 308 312 308 309 classes directory 306 creating 307 deployment descriptor 299 expanded 319, 320 files 302, 304 lib directory 306 registering with JSP container 299 web server clustering 246 web teams 114 web.xml 299–301, 406, 476, 486, 487 webdev 485, 487 WEB-INF directory 299, 305, 485, 486, 488 classes directory 306, 315 lib directory 306, 315, 475, 484 tlds directory 307, 315, 406 WebLogic 12, 505 WebSphere 12, 15, 142, 242, 506 while loop 77 white space 130 Whois 378 Windows NT See Microsoft, Windows NT Windows See Microsoft, Windows withArticle() 69 WML (Wireless Markup Language) worker Beans 121 World Wide Web Consortium (W3C) 32 write-only property 153 WYSIWYG 12 X XML 9, 28–30, 55, 66, 81, 104, 299–300, 307, 364, 405, 486 namespace 513 Z Zip 482