SCWCD Exam Study Kit: Java Web Component Developer Certification

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This book was good during it's time, but now it is outdated. The book is designed for SCWCD 1.3, and did a great job covering all the topics. However, Sun Microsystem discontinued SCWCD 1.3 on December 2004. So, if you are like me, disappointed with head first books and looking to be certified as fast as possible, do yourself a favor and buy the second edition of this book. You won't regret it.

Author(s): Hanumant Deshmukh, Jignesh Malavia
Publisher: Manning Publications
Year: 2002

Language: English
Pages: 562

preface......Page 17
about this book......Page 20
taking the exam......Page 23
about the authors......Page 25
acknowledgments......Page 26
about the cover illustration......Page 28
PART 1......Page 29
1.1.1 Server responsibilities......Page 31
1.1.2 Server extensions......Page 32
1.2.1 The big picture......Page 33
1.2.2 Understanding servlet containers......Page 34
1.2.3 Using Tomcat......Page 35
1.3.1 Code......Page 36
1.4 The relationship between a servlet container and the Servlet API......Page 37
1.4.1 The javax.servlet package......Page 38
1.4.2 The javax.servlet.http package......Page 39
1.5 Summary......Page 40
2.1 What is a JSP page?......Page 42
2.2.1 The HTML code......Page 43
2.2.3 The JSP code......Page 44
2.4.1 The Model 1 architecture......Page 45
2.4.2 The Model 2 architecture......Page 46
2.5 A note about JSP syntax......Page 47
2.6 Summary......Page 48
Web application and HTTP basics......Page 49
3.1.2 Web applications and the web application server......Page 50
3.2 Understanding the HTTP protocol......Page 51
3.2.2 The structure of an HTTP request......Page 52
3.2.3 The structure of an HTTP response......Page 54
3.3 Summary......Page 55
PART 2......Page 57
The Servlet model......Page 59
4.1 Sending requests: Web browsers and HTTP methods......Page 60
4.1.1 Comparing HTTP methods......Page 61
4.2 Handling HTTP requests in anHttpServlet......Page 62
4.3.1 Understanding ServletRequest......Page 64
4.3.2 Understanding HttpServletRequest......Page 65
4.4.1 Understanding ServletResponse......Page 67
4.4.2 Understanding HttpServletResponse......Page 70
4.5.1 Loading and instantiating a servlet......Page 73
4.5.2 Initializing a servlet......Page 74
4.5.6 Servlet state transition from the servlet container’s perspective......Page 75
4.6.1 ServletConfig methods......Page 77
4.6.2 Example: a servlet and its deployment descriptor......Page 78
4.7 ServletContext: a closer look......Page 80
4.8 Beyond servlet basics......Page 82
4.8.1 Sharing the data (attribute scopes)......Page 83
4.8.2 Coordinating servlets using RequestDispatcher......Page 84
4.8.3 Putting it all together: A simple banking application......Page 86
4.9 Summary......Page 89
4.10 Review questions......Page 90
Structure and deployment......Page 94
5.1 Directory structure of awebapplication......Page 95
5.1.2 Understanding the WEB-INF directory......Page 96
5.1.4 The default web application......Page 97
5.2 The deployment descriptor: an overview......Page 98
5.2.1 Example: A simple deployment descriptor......Page 99
5.2.2 Using the element......Page 100
5.2.3 Using the element......Page 101
5.2.4 Mapping a URL to a servlet......Page 102
5.4 Review questions......Page 106
The servlet container model......Page 109
6.1 Initializing ServletContext......Page 110
6.2 Understanding application eventsandlisteners......Page 111
6.2.1 javax.servlet.ServletContextListener......Page 112
6.2.2 javax.servlet.ServletContextAttributeListener......Page 113
6.3 Configuring a web application......Page 114
6.4 Web applications in a distributedenvironment......Page 116
6.4.1 Behavior of a ServletContext......Page 117
6.5 Summary......Page 118
6.6 Review questions......Page 119
Handling server-side exceptions......Page 122
7.1 Handling exceptions programmatically......Page 123
7.1.1 Handling business logic exceptions......Page 125
7.2.1 Using declarative exception handling......Page 127
7.2.2 Using servlets and JSP pages as exception handlers......Page 129
7.3 Using RequestDispatcher to handleexceptions......Page 133
7.3.1 Handling exceptions thrown by RequestDispatcher......Page 134
7.4 Logging......Page 135
7.5 Summary......Page 136
7.6 Review questions......Page 137
Session management......Page 141
8.1 Understanding state and sessions......Page 142
8.2 Using HttpSession......Page 143
8.2.1 Working with an HttpSession......Page 144
8.2.2 Handling session events with listener interfaces......Page 146
8.2.3 Expunging a session......Page 151
8.3 Understanding session timeout......Page 152
8.4 Implementing session support......Page 153
8.4.1 Supporting sessions using cookies......Page 154
8.4.2 Supporting sessions using URL rewriting......Page 155
8.5 Summary......Page 157
8.6 Review questions......Page 158
Developing secure webapplications......Page 161
9.1.2 Authorization......Page 162
9.1.7 Web site attacks......Page 163
9.2 Understanding authentication mechanisms......Page 164
9.2.1 HTTP Basic authentication......Page 165
9.2.4 FORM-based authentication......Page 167
9.2.5 Defining authentication mechanisms for web applications......Page 168
9.3 Securing web applications declaratively......Page 170
9.3.2 web-resource-collection......Page 171
9.3.3 auth-constraint......Page 172
9.3.5 Putting it all together......Page 173
9.4 Securing web applications programmatically......Page 177
9.5 Summary......Page 179
9.6 Review questions......Page 180
Developing thread-safe servlets......Page 184
10.1 Understanding the multithreaded servletmodel......Page 185
10.2 Understanding the singlethreaded model......Page 187
10.2.1 The javax.servlet.SingleThreadModel interface......Page 188
10.3 Variable scopes and thread safety......Page 190
10.3.1 Local variables......Page 191
10.3.2 Instance variables......Page 192
10.4 Attribute scopes and thread safety......Page 194
10.4.1 Context scope......Page 195
10.4.2 Session scope......Page 196
10.5 Summary......Page 198
10.6 Review questions......Page 199
PART 3......Page 201
The JSP technology model—the basics......Page 203
11.1 JSP syntax elements......Page 204
11.1.1 Directives......Page 205
11.1.2 Declarations......Page 206
11.1.3 Scriptlets......Page 207
11.1.4 Expressions......Page 208
11.1.5 Actions......Page 209
11.1.6 Comments......Page 210
11.2.3 JSP life-cycle phases......Page 212
11.2.4 JSP life-cycle example......Page 216
11.3 Understanding JSP pagedirectiveattributes......Page 219
11.3.3 The errorPage and isErrorPage attributes......Page 220
11.3.6 The isThreadSafe attribute......Page 222
11.3.8 The contentType and pageEncoding attributes......Page 224
11.4 Summary......Page 225
11.5 Review questions......Page 226
The JSP technology model— advanced topics......Page 228
12.1 Understanding the translation process......Page 229
12.1.1 Using scripting elements......Page 230
12.1.2 Using conditional and iterative statements......Page 231
12.1.4 Using escape sequences......Page 234
12.2 Understanding JSP implicit variables and JSP implicit objects......Page 238
12.2.2 session......Page 240
12.2.3 request and response......Page 241
12.2.5 pageContext......Page 242
12.2.6 out......Page 243
12.2.7 config......Page 244
12.2.8 exception......Page 245
12.3 Understanding JSP page scopes......Page 246
12.3.2 Session scope......Page 247
12.3.3 Request scope......Page 248
12.3.4 Page scope......Page 249
12.4 JSP pages as XML documents......Page 251
12.4.1 The root element......Page 252
12.4.3 Text, comments, and actions......Page 253
12.6 Review questions......Page 255
Reusable web components......Page 259
13.1 Static inclusion......Page 260
13.1.1 Accessing variables from the included page......Page 261
13.2 Dynamic inclusion......Page 262
13.2.1 Using jsp:include......Page 263
13.2.2 Using jsp:forward......Page 264
13.2.3 Passing parameters to dynamically included components......Page 265
13.2.4 Sharing objects with dynamically included components......Page 267
13.3 Summary......Page 271
13.4 Review questions......Page 272
Using JavaBeans......Page 276
14.1.1 JavaBeans from the JSP perspective......Page 277
14.1.2 The JavaBean advantage......Page 278
14.1.3 Serialized JavaBeans......Page 280
14.2.1 Declaring JavaBeans using ......Page 283
14.2.2 Mutating properties using ......Page 291
14.2.3 Accessing properties using ......Page 294
14.3 JavaBeans in servlets......Page 296
14.4 Accessing JavaBeans from scripting elements......Page 299
14.5.1 Using non-string data type properties......Page 301
14.5.2 Using indexed properties......Page 303
14.6 Summary......Page 305
14.7 Review questions......Page 306
Using custom tags......Page 310
15.1.1 New terms......Page 311
15.1.2 Understanding tag libraries......Page 312
15.2 Informing the JSP engine about acustom tag library......Page 313
15.2.1 Location of a TLD file......Page 314
15.2.3 Understanding explicit mapping......Page 315
15.2.4 Resolving URIs to TLD file locations......Page 316
15.3 Using custom tags in JSP pages......Page 318
15.3.1 Empty tags......Page 319
15.3.2 Tags with attributes......Page 320
15.3.3 Tags with JSP code......Page 321
15.3.4 Tags with nested custom tags......Page 322
15.5 Review questions......Page 323
Developing custom taglibraries......Page 326
16.1 Understanding the tag library descriptor......Page 328
16.1.1 The element......Page 329
16.1.2 The element......Page 331
16.1.3 The element......Page 332
16.1.4 The element......Page 334
16.2 The Tag Extension API......Page 336
16.3 Implementing the Tag interface......Page 338
16.3.1 Understanding the methods of the Tag interface......Page 339
16.3.2 An empty tag that prints HTML text......Page 342
16.3.3 An empty tag that accepts an attribute......Page 344
16.3.4 A non-empty tag that includes its body content......Page 345
16.4.1 Understanding the IterationTag methods......Page 347
16.4.2 A simple iterative tag......Page 349
16.5.1 Understanding the methods of BodyTag......Page 351
16.5.2 A tag that processes its body......Page 352
16.6 Extending TagSupport and BodyTagSupport......Page 355
16.6.2 The BodyTagSupport class......Page 356
16.6.3 Accessing implicit objects......Page 357
16.6.4 Writing cooperative tags......Page 360
16.7 What’s more?......Page 365
16.8 Summary......Page 366
16.9 Review questions......Page 367
PART 4......Page 371
Design patterns......Page 373
17.1.2 The Gang of Four patterns......Page 374
17.1.3 The distributed design patterns......Page 376
17.1.4 The J2EE patterns......Page 377
17.2.1 The pattern template......Page 380
17.2.2 Value Object......Page 382
17.2.3 Model-View-Controller (MVC)......Page 386
17.2.4 Data Access Object (DAO)......Page 388
17.2.5 Business Delegate......Page 392
17.2.6 Front Controller......Page 396
17.2.7 Putting it all together......Page 399
17.4 Review questions......Page 401
Using filters......Page 404
18.1 What is a filter?......Page 405
18.1.1 How filtering works......Page 406
18.1.3 The Hello World filter......Page 407
18.2 The Filter API......Page 409
18.2.1 The Filter interface......Page 410
18.2.3 The FilterChain interface......Page 412
18.3.1 The element......Page 413
18.3.3 Configuring a filter chain......Page 414
18.4.1 Using the request and response wrappers......Page 417
18.4.3 Using filters with MVC......Page 423
18.5 Summary......Page 424
A.3 Installation......Page 425
A.4 Directory structure......Page 426
A.5 Running Tomcat......Page 427
A.7 Security......Page 428
B.1 What is XML?......Page 430
B.2 XML syntax......Page 431
B.2.1 XML elements......Page 432
B.2.2 Attributes......Page 433
B.3.1 Understanding a DTD......Page 434
B.3.2 Defining elements......Page 436
B.3.3 Defining attributes......Page 437
B.4 Further reading......Page 438
A sample web.xml file......Page 439
Review Q & A......Page 443
Exam Quick Prep......Page 503
Symbols......Page 549
C......Page 550
E......Page 551
H......Page 552
I......Page 553
L......Page 554
R......Page 555
S......Page 556
T......Page 557
Z......Page 558