Patrick Lightbody, Jason Carreira1932394532, 9781932394535, 9781932394641
Table of contents :
brief contents……Page 6
contents……Page 8
foreword……Page 16
preface……Page 18
acknowledgments……Page 20
about this book……Page 22
Roadmap……Page 23
Who should read this book?……Page 24
Author Online……Page 25
About the authors……Page 26
a look at the future……Page 27
about the title……Page 28
about the cover illustration……Page 29
An overview of WebWork……Page 34
1.1 Why MVC is important……Page 36
1.1.1 Classic MVC becomes outdated……Page 37
1.1.3 MVC evolves: the Page Controller……Page 38
1.2.1 What is a framework?……Page 40
1.2.2 What a container can do……Page 42
1.3.2 Understanding the XWork core……Page 44
1.4 The CaveatEmptor application……Page 46
1.4.1 How CaveatEmptor is organized……Page 47
1.5 Summary……Page 48
HelloWorld, the WebWork way……Page 50
2.2 Preparing the skeleton……Page 51
2.2.1 Creating the web.xml deployment file……Page 52
2.2.3 Creating the webwork.properties configuration file……Page 54
2.3 Your first action……Page 55
2.3.1 Saying hello, the WebWork way……Page 56
2.3.2 Displaying output to the web browser……Page 57
2.3.3 Configuring your new action……Page 58
2.4 Dealing with inputs……Page 59
2.5 Advanced control flow……Page 62
2.6 Letting WebWork do the work……Page 64
2.6.1 Taking advantage of ActionSupport……Page 65
2.6.2 Intermediate modifications to the JSP……Page 66
2.6.3 Exploring the UI tag library……Page 67
2.7 Summary……Page 68
Setting up WebWork……Page 69
3.1.1 Overview of terminology……Page 70
3.1.2 Actions……Page 71
3.1.3 Results……Page 77
3.1.4 Interceptors……Page 79
3.2.1 The xwork.xml DTD……Page 83
3.2.2 Namespaces and packages……Page 84
3.2.3 Componentization using the include tag……Page 88
3.3.1 Web-app configuration: web.xml……Page 97
3.3.2 Feature configuration: webwork.properties……Page 98
3.4.1 General layout……Page 101
3.4.2 Required libraries……Page 102
3.5 Summary……Page 103
Implementing WebWork actions……Page 108
4.1.1 Result codes……Page 109
4.1.2 Handling exceptions……Page 110
4.3 Understanding basic validation……Page 111
4.3.1 Validating an action: Validateable……Page 112
4.3.2 Displaying error messages: ValidationAware……Page 113
4.4.2 Displaying the localized text: TextProvider……Page 117
4.4.3 Providing messages for other languages……Page 120
4.5.1 Intermediary objects……Page 121
4.5.2 Using domain objects directly……Page 122
4.6 Working with ModelDriven actions……Page 126
4.6.1 Implementing ModelDriven actions……Page 127
4.6.2 Considerations when using ModelDriven……Page 131
4.7.1 CaveatEmptor: accessing the session……Page 133
4.7.2 Example: accessing the request and response……Page 136
4.8.1 Accessing uploaded files through the request wrapper……Page 138
4.8.2 Automating file uploads……Page 140
4.8.3 Configuration settings……Page 141
4.9 Summary……Page 142
Adding functionality with interceptors……Page 143
5.1 How interceptors are called……Page 144
5.2 Using the prepackaged interceptors……Page 145
5.2.1 Utility interceptors……Page 148
5.2.2 Setting parameters……Page 150
5.2.3 Defining workflow……Page 154
5.3 Using prepackaged interceptor stacks……Page 157
5.4 Building your own interceptors……Page 159
5.4.1 Using the AroundInterceptor as a base……Page 160
5.4.2 Looking at an example custom interceptor……Page 161
5.4.3 Getting callbacks before the result is executed with the PreResultListener……Page 164
5.4.4 Looking out for interceptor interactions……Page 165
5.5 Interceptors vs. servlet filters……Page 166
5.6 Summary……Page 167
Inversion of Control……Page 168
6.1.1 Common patterns for active resource management……Page 169
6.1.2 Inverting resource management……Page 173
6.1.3 How IoC helps with testing……Page 176
6.2.1 WebWork’s IoC history……Page 177
6.2.2 Dependencies……Page 179
6.2.3 Scope and lifecycle……Page 180
6.3.1 Configuration……Page 182
6.3.2 Creating a new component……Page 185
6.3.3 Using IoC on any object……Page 189
6.3.4 Dealing with complex dependencies……Page 190
6.4 An example from CaveatEmptor……Page 193
6.4.1 The HibernateSessionFactory component……Page 194
6.4.2 The PersistenceManager component……Page 196
6.4.3 Configuring the components……Page 199
6.4.4 Using the new components……Page 200
6.5.1 Alternative IoC containers……Page 201
6.5.2 Non-IoC alternatives……Page 203
6.6 Summary……Page 204
Using results……Page 208
7.1.1 A simple result……Page 209
7.1.2 Configuring a result……Page 211
7.2.1 Dispatching to a page……Page 213
7.2.2 Redirecting to a page……Page 219
7.2.3 Chaining to another action……Page 223
7.3.1 Streaming Velocity templates directly to the output……Page 228
7.3.2 FreeMarker: an alternative to Velocity……Page 233
7.3.3 Generating reports with JasperReports……Page 234
7.4 Summary……Page 238
Getting data with the expression language……Page 240
8.1.1 Why an expression language?……Page 241
8.1.2 Why OGNL?……Page 242
8.1.3 Other expression languages……Page 243
8.2 Basic expression language features……Page 244
8.2.1 Accessing bean properties……Page 245
8.2.2 Literals and operators……Page 246
8.2.3 Calling methods……Page 248
8.2.6 Accessing the OGNL context and the ActionContext……Page 249
8.3.1 Working with lists and arrays……Page 251
8.3.2 Working with maps……Page 252
8.3.3 Filtering and projecting collections……Page 253
8.3.4 The multiple uses of “#”……Page 254
8.4.1 Linking the value stack to the expression language……Page 255
8.4.2 Data type conversion……Page 257
8.4.3 Handling null property access……Page 258
8.5 Summary……Page 259
Tag libraries……Page 261
9.1 Getting started……Page 262
9.2 An overview of WebWork tags……Page 263
9.2.1 The WebWork tag syntax……Page 264
9.3.1 The property tag……Page 266
9.3.2 The set tag……Page 267
9.3.3 The push tag……Page 268
9.3.4 The bean tag……Page 269
9.3.5 The action tag……Page 271
9.4.1 The iterator tag……Page 273
9.4.2 The if and else tags……Page 276
9.5.1 The include tag……Page 277
9.5.2 The URL tag……Page 278
9.5.3 The i18n and text tags……Page 281
9.5.4 The param tag……Page 283
9.6 Summary……Page 284
Velocity……Page 285
10.1.1 What is Velocity?……Page 286
10.1.2 Getting ready to use Velocity……Page 288
10.2.1 Property access……Page 290
10.2.3 Control statements: if/else and loops……Page 292
10.3.1 The VelocityContext……Page 296
10.3.2 WebWork-supplied objects in the context……Page 297
10.3.3 Customizing the Velocity context……Page 298
10.4 Using JSP tags in Velocity……Page 299
10.6 Summary……Page 300
UI components……Page 302
11.1.1 Eliminating the pain……Page 303
11.1.2 More than just form elements……Page 311
11.2.1 Templates……Page 314
11.2.2 Themes……Page 316
11.3.1 Common attributes……Page 322
11.3.2 Simple tags……Page 325
11.3.3 Collection-based tags……Page 330
11.3.4 Advanced tags……Page 336
11.4 Summary……Page 340
Type conversion……Page 344
12.1.1 The Servlet specification……Page 345
12.1.2 An action without type conversion……Page 346
12.1.3 A view without type conversion……Page 348
12.1.4 What WebWork’s type conversion gives you……Page 350
12.2 Configuration……Page 351
12.2.1 Role of a type converter……Page 352
12.2.3 Class-level type converters……Page 353
12.3.1 Basic type conversion……Page 354
12.3.2 Built-in type conversion……Page 356
12.4.1 Handling null Collection access……Page 357
12.4.2 Handling conversion errors……Page 360
12.4.3 An example that puts it all together……Page 361
12.5 Summary……Page 362
Validating form data……Page 364
13.1.1 Validating in the execute() method……Page 367
13.1.2 Implementing the Validateable interface……Page 368
13.2.1 Building your first *-validation.xml file……Page 371
13.2.2 Registering validators……Page 372
13.2.3 Applying the validation interceptor……Page 376
13.2.4 Pulling it all together……Page 377
13.2.5 Looking at some validation XML examples……Page 379
13.3 Exploring the advanced features of the Validation Framework……Page 381
13.3.1 Implementing a custom validator……Page 382
13.3.2 Validating with different contexts……Page 384
13.3.3 Short-circuiting validation……Page 385
13.3.4 The ExpressionValidator……Page 386
13.3.5 Reusing validations with the visitor field validator……Page 387
13.4 Summary……Page 390
Internationalization……Page 391
14.1 Exploring a quick internationalization example……Page 392
14.2 Sources for messages……Page 393
14.2.1 Understanding the ResourceBundle search order……Page 395
14.2.3 The tag……Page 397
14.3.1 Parameterizing localized texts……Page 399
14.3.2 Using getText() in taglib attributes……Page 400
14.3.4 Using localized messages in validations……Page 401
14.3.5 Using internationalized texts for type conversion messages……Page 402
14.4.1 Programmatically setting the locale……Page 404
14.4.2 Implementing ResourceBundles as classes……Page 406
14.4.3 Using the tag to pass dynamically generated text to message texts……Page 409
14.4.4 Setting the encoding: here, there, and everywhere……Page 412
14.4.6 A final note……Page 413
14.5 Summary……Page 414
Best practices……Page 415
15.1 Setting up your environment……Page 416
15.1.1 Setting up your IDE……Page 417
15.1.2 Reloading resources……Page 419
15.2.1 Using mock objects……Page 420
15.2.3 Handling statics and ThreadLocals……Page 422
15.3.1 Testing your configuration……Page 424
15.3.2 Seeing the configuration with the config browser……Page 427
15.4.2 Testing validation.xml files……Page 429
15.5 Advanced UI tag usage……Page 433
15.5.1 Overriding existing templates……Page 434
15.5.2 Writing custom templates……Page 437
15.5.3 Writing custom themes……Page 438
15.6 Using form tokens to prevent duplicate form submissions……Page 440
15.6.1 Using the tag……Page 441
15.6.2 Applying the TokenInterceptor……Page 443
15.7 Displaying wait pages automatically……Page 444
15.8 A Single action for CRUD operations……Page 448
15.8.1 Creating new categories with newCategory……Page 449
15.8.2 Reading and updating with viewCategory and editCategory……Page 450
15.8.3 Saving categories with saveCategory……Page 451
15.8.4 Setting the parentCategory……Page 453
15.9 Summary……Page 454
Appendix: WebWork architecture……Page 455
A.1 Implementing the Command pattern……Page 456
A.1.1 Basic Command pattern features……Page 457
A.2 Actions……Page 458
A.3 Interceptors……Page 459
A.5.1 OGNL……Page 460
A.6 ActionProxy / ActionInvocation……Page 461
A.7 ActionContext……Page 463
A.7.1 ThreadLocal storage……Page 466
A.8 The servlet dispatcher……Page 467
A.9 Summary……Page 468
index……Page 470
Reviews
There are no reviews yet.