Art of Java Web Development: Struts, Tapestry, Commons, Velocity, JUnit, Axis, C

Neal Ford

  • 出版商: Manning
  • 出版日期: 2003-11-01
  • 售價: $1,480
  • 貴賓價: 9.5$1,406
  • 語言: 英文
  • 頁數: 624
  • 裝訂: Paperback
  • ISBN: 1932394060
  • ISBN-13: 9781932394061
  • 相關分類: Java 程式語言Java 相關技術

已過版

買這商品的人也買了...

相關主題

商品描述

A guide to the topics required for state of the art web development, this book covers wide-ranging topics, including a variety of web development frameworks and best practices. Beginning with coverage of the history of the architecture of web applications, highlighting the uses of the standard web API to create applications with increasingly sophisticated architectures, developers are led through a discussion on the development of industry accepted best practices for architecture.

Described is the history and evolution towards this architecture and the reasons that it is superior to previous efforts. Also provided is an overview of the most popular web application frameworks, covering their architecture and use. Numerous frameworks exist, but trying to evaluate them is difficult because their documentation stresses their advantages but hides their deficiencies. Here, the same application is built in six different frameworks, providing a way to perform an informed comparison. Also provided is an evaluation of the pros and cons of each framework to assist in making a decision or evaluating a framework on your own. Finally, best practices are covered, including sophisticated user interface techniques, intelligent caching and resource management, performance tuning, debugging, testing, and Web services

Table of Contents

preface xvii
acknowledgments xix

about the book xxi
about the cover illustration xxx

Part I The evolution of web architecture and design 1

1 State-of-the-art web design 3
1.1 A brief history of Java web development 4
1.2 The importance of design patterns 6
The Model-View-Controller design pattern 7
The emergence of Model 2 9
Evolution 10
1.3 Using frameworks 11
A flavor of the Struts framework 12
A flavor of the Turbine framework 14
Objectively choosing a framework 20
1.4 Best practices 20
Business rules 20
Where should the rules reside? 22
Leveraging best practices 24
1.5 Summary 25
2 Building web applications 27
2.1 Building web applications with servlets 29
The eMotherEarth servlet application 29
Evaluating the servlet approach 50
2.2 Building web applications with JSP 50
The JSP eMotherEarth application 51
Evaluating the JSP approach 59
2.3 Summary 60
3 Creating custom JSP tags 61
3.1 The case for custom tags 62
3.2 The tag interfaces 63
The Tag interface 63
The IterationTag interface 64
The BodyTag interface 65
3.3 Building simple tags 66
The HtmlSqlResult tag 66
Registering the tag 71
3.4 Validating tag attributes 75
Adding DbPool to the application tag 75
3.5 Using prebuilt tags 80
Using JSTL 81
Using other taglibs 84
3.6 Custom tag considerations 86
Resource usage 87
Building a framework 88
3.7 Now that we’re here, where are we? 88
3.8 Summary 89
4 The Model 2 design pattern 91
4.1 Using Model 2 as your framework 92
The Model 2 schedule application 93
Options in Model 2 116
4.2 Parameterizing commands with controller servlets 117
An example of parameterizing commands 118
Advantages and disadvantages 127
4.3 Summary 128

Part II Web frameworks 131

5 Using Struts 133
5.1 Building Model 2 Web applications with Struts 134
The Struts schedule application 134
Value objects as form beans 136
Objectifying commands with Struts’ actions 137
Configuring Struts applications 139
Using Struts’ custom tags to simplify JSP 142
Internationalization with Struts 145
Struts’ support for data entry 147
Declarative validations 151
5.2 Evaluating Struts 156
5.3 Summary 157
6 Tapestry 159
6.1 Overview 160
6.2 The architecture 160
6.3 A simple Tapestry application 162
Tapestry Hello, World 162
6.4 The Tapestry framework 167
Framework classes and interfaces 167
Components 170
6.5 Scheduling in Tapestry 173
Bootstrapping the application 173
The Home page 176
The custom table component 180
The Add page 185
6.6 Evaluating Tapestry 192
Documentation and samples 192
Debugging support 195
Using Tapestry 196
6.7 Summary 197
7 WebWork 199
7.1 Overview 200
The architecture 201
The configuration 202
7.2 Key concepts 203
Actions 204
Key interfaces 204
The value stack 205
Expression language 206
BeanInfo classes 207
Templates 207
7.3 Scheduling in WebWork 208
The configuration 208
The View page 209
The Add page 214
Validations 220
7.4 Evaluating WebWork 224
7.5 Summary 226
8 InternetBeans Express 227
8.1 Overview 228
8.2 The architecture 230
DataExpress 230
InternetBeans Express 233
8.3 InternetBeans Express components 234
ixPageProducer 234
ixComponents 236
8.4 Scheduling with InternetBeans 237
Data connectivity 238
The View page 242
The Add page 245
Validations 249
8.5 JSP custom tags 255
8.6 Evaluating InternetBeans Express 257
Documentation and samples 257
Using InternetBeans Express 258
8.7 Summary 259
9 Velocity 261
9.1 Overview 262
9.2 The architecture 263
9.3 Key concepts 265
Setting up Velocity 265
The Velocity Template Language 268
Context 269
9.4 Scheduling with Velocity 269
The View page 271
The Add page 274
Validations 278
9.5 Evaluating Velocity 281
Documentation and samples 281
Using Velocity 282
9.6 Summary 282
10 Cocoon 283
10.1 Overview 284
10.2 The architecture 285
The publishing framework 285
The web framework 288
10.3 Key concepts 289
The publishing framework 289
The sitemap 295
The web framework 299
10.4 Scheduling in Cocoon 302
The sitemap 303
The action 304
The view 305
10.5 Evaluating Cocoon 307
Documentation and samples 307
Source code 308
Debugging 308
10.6 Summary 309
11 Evaluating frameworks 311
11.1 Evaluation criteria 312
Suitability to the application 312
Documentation 315
Source code 316
Tool support 317
External criteria 318
11.2 Design considerations 319
Adherence to good design principles 319
The user interface 320
Innovative features 321 Insularity 322 - “Feel” 322
11.3 What I like 323
Transparent infrastructure 323
Innovative ideas 323
Ultra-high cohesion and low coupling 324
Evaluating frameworks as a hobby 324
11.4 Summary 324

Part III Best practices 327

12 Separating concerns 329
12.1 Using interfaces to hide implementation 330
JDBC interfaces 331
nterfaces in frameworks 331
Decoupled classes 332
12.2 Using JavaBeans 333
Model beans 334
12.3 Using Enterprise JavaBeans 337
The EJB architecture 338
Porting from JavaBeans to Enterprise JavaBeans 340
Using EJBs in web frameworks 360
Managing JNDI context 361
12.4 Performing validations with model beans 362
Client-side validations 362
Building client-side validations from the server 365
12.5 Summary 368
13 Handling flow 371
13.1 Application usability options 372
Building the base: eMotherEarth.com 372
Page-at-a-time scrolling 378
Sortable columns 384
User interface techniques in frameworks 389
13.2 Building undo operations 390
Leveraging transaction processing 391
Using the Memento design pattern 394
Undo in frameworks 401
13.3 Using exception handling 401
The difference between technical and domain exceptions 401
Creating custom exception classes 402
Where to catch and handle exceptions 403
Exceptions in frameworks 406
13.4 Summary 407
14 Performance 409
14.1 Profiling 410
Measuring memory 410
Performance profiling 412
Load testing 419
Performance of profiling frameworks 421
14.2 Common performance pitfalls 421
Object creation 422
Extraneous object references 424
String usage 426
14.3 Pooling 427
Simple object pools 427
Soft and weak references 428
Commons pools 433
Pooling in frameworks 440
14.4 Designing for scalability 440
When to scale up to EJB 441
Molding your architecture for the future 441
14.5 When to optimize 442
14.6 Summary 443
15 Resource management 445
15.1 Caching strategies 446
Caching with the Flyweight design pattern 447
Caching with the Façade design pattern 453
Resource management in frameworks 469
15.2 Other resources you need to manage 470
Effectively using JNDI 470
Using lazy instantiation 472
Working with web collections 472
15.3 Summary 473
16 Debugging 475
16.1 Debugging web applications 476
16.2 Debugging with the SDK 483
Starting the debugger 483
Running the debugger 486
Breakpoints and steps 489
Accessing variables 490
Effectively using jdb 492
16.3 Debugging with IDEs 493
Debugging with NetBeans 493
Debugging with JBuilder 498
Differences between debuggers 502
16.4 Evaluating debuggers 505
16.5 Debugging in frameworks 506
Struts 506 - Tapestry 507
WebWork 507
InternetBeans Express 507
Velocity 508
Cocoon 508
16.6 Logging 508
General logging concepts 509
SDK logging 512
log4j logging 516
Choosing a logging framework 519
Logging in frameworks 519
16.7 Summary 520
17 Unit testing 521
17.1 The case for testing 522
Agile development 522
Unit testing in web applications 524
17.2 Unit testing and JUnit 525
Test cases 525
Testing entities 525
Running tests 528
Test suites 529
Testing boundaries 530
Tool support 534
17.3 Web testing with JWebUnit 536
JWebUnit TestCases 537
Testing complex elements 539
17.4 Summary 541
18 Web services and Axis 543
18.1 Key concepts 544
18.2 Axis 545
Architecture of Axis 546
Axis tools 547
18.3 Calling web services 551
18.4 eMotherEarth web services 553
Configuration 553
Orders 556
Calling the web service 559
18.5 Summary 562
19 What won’t fit in this book 563
19.1 Persistence 564
Plain old Java objects 564
Enterprise JavaBeans 564
Java data objects (JDO) 565
Hibernate 566
19.2 HTML and the user interface 566
HTML/XHTML 567
Cascading Style Sheets 567
19.3 JavaScript 568
19.4 Summary 569

bibliography 570
index 571