Table of Contents
preface xi
acknowledgments xii
how to use this book xiv
author online xvi
about the cover illustration xvii
1 Introduction 1
1.1
The world wide web 2
1.2 Current applications 6
1.3 Future applications 8
1.4 Java language 9
1.5 Java server API 14
1.6 Java servlet API 14
1.7 The future of Java and servlets 14
1.8 Who should read this book? 15
2 Java servlets API 16
2.1 Servlet introduction 17
2.2 A day in the life of a servlet 19
2.3 Servlet security 20
2.4 Java Servlet Development Kit installation 22
2.5 Servlet structure 23
2.6 Web-based servlets 29
2.7 HttpServlet 29
2.8 From here 36
3 Java web server 37
3.1 Installation 38
3.2 Administration 39
3.3 Proxy server 57
3.4 Secure web server 58
3.5 Core servlets 58
4 Servlet engines 60
4.1 Test environment 61
4.2 ServletExec 61
4.3 Installation 61
4.4 JRun 68
4.5 Other servlet engines 75
5 Debugging and optimization techniques 76
5.1 Debugging 77
5.2 Optimization 88
6 CGI overview 90
6.1 What is CGI? 91
6.2 CGI in operation 92
6.3 General limitations 96
6.4 CGI implementation 97
6.5 Future of CGI 100
6.6 From here 101
7 HTML page counters 102
7.1 What is a hit counter? 103
7.2 Simple counters 105
7.3 Advanced counters 109
7.4 Further development 118
8 General HTML utilities 120
8.1 Navigational forms 121
8.2 File uploading 123
8.3 Zip archive retrieval 132
8.4 HTML template class 134
8.5 Other application areas 139
9 HTML form processing 140
9.1 Form introduction 141
9.2 Basic form processing 144
9.3 Generic form2email 151
9.4 Confirmation forms 153
9.5 Future extensions 159
10 Guest books 160
10.1 What is a guest book? 161
10.2 A simple guest book servlet 162
10.3 Email class 167
10.4 HTML removal 171
10.5 Other application areas 172
10.6 From here 173
11 Newsgroups 174
11.1 What is a newsgroup? 175
11.2 Implementing a newsgroup 177
11.3 Complete source code 194
11.4 Future extensions 198
12 Quote generator 199
12.1 Simple quote generator 200
12.2 Advanced quote generater 204
12.3 Random quote generater 205
12.4 Handling much larger data sets 206
12.5 Possible alternative uses for the quote generator 210
12.6 From here 210
13 Random links 211
13.1 What is a random link? 212
13.2 Random link administration 216
13.3 Complete source code 219
13.4 Future extensions 221
13.5 From here 222
14 Dynamic images 223
14.1 Serving images 224
14.2 Server-side push 228
14.3 Future extensions 230
15 HTML filters 231
15.1 HTML filters 232
15.2 Search and destroy 233
15.3 Search and replace 240
15.3 Future extensions 243
16 Autolinks 244
16.1 Glossary definition 245
16.2 System overview 246
16.3 Linking the keywords 249
16.4 Complete source code 257
16.5 Future extensions 261
16.6 From here 262
17 Link validation 263
17.1 Introduction to web crawlers 264
17.2 Performance issues 283
17.3 Future extensions 283
18 Search engine 285
18.1 Search engines overview 286
18.2 Search logistics 288
18.3 Global search servlet 290
18.4 Local search servlet 303
18.5 Summary and possible enhancements 309
19 Client-side data 311
19.1 Cookies 312
19.2 Future extensions 324
20 Online games 325
20.1 Slot machine 326
20.2 Spinning the wheels 328
20.3 Roulette 331
20.4 Future extensions 350
21 Banner advertising 351
21.1 Introduction to banner advertising 352
21.2 Real estate: selling space 354
21.3 From here 375
22 Email fortune cookies 376
22.1 Mailing list servlet 377
22.2 Fortune cookie servlet 387
22.3 Future extensions 403
23 Online shopping 404
23.1 Introduction 405
23.2 Virtual store structure 407
23.3 Virtual shopping basket 409
23.4 The checkout 414
23.5 Making payment 417
23.6 Future extensions 418
24 Servlets and JDBC 419
24.1 JDBC overview 420
24.2 Method #1: connection per client 424
24.3 Method #2: connection pool 428
24.4 Future extensions 438
25 Internet chats 439
25.1 Chat introduction 440
25.2 Applet-based chat 447
25.3 Performance 467
25.4 Future extensions 468
26 Servlets and RMI 470
26.1 RMI overview 471
26.2 Servlets and RMI 477
26.3 Summary 480
27 Servlet-to-servlet communication 481
27.1 Common base class 482
27.2 Summary 489
appendix A 490
appendix B 537
appendix C 539
index 542