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.
Neal Ford is the chief technology officer at the DSW Group, Ltd. He is an architect, designer, and developer of applications, instructional materials, magazine articles, and video presentations and the author of Developing with Delphi: Object-Oriented Techniques and JBuilder 3 Unleashed. He lives in Atlanta, Georgia.
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