SlideShare a Scribd company logo
Visit https://ebookfinal.com to download the full version and
explore more ebooks
WebWork in Action In Action First Edition
Patrick Lightbody
_____ Click the link below to download _____
https://ebookfinal.com/download/webwork-in-action-in-
action-first-edition-patrick-lightbody/
Explore and download more ebooks at ebookfinal.com
Here are some suggested products you might be interested in.
Click the link to download
IntelliJ IDEA in Action In Action series 1st Edition
Stephen Saunders
https://ebookfinal.com/download/intellij-idea-in-action-in-action-
series-1st-edition-stephen-saunders/
Scala in Action Nilanjan Raychaudhuri
https://ebookfinal.com/download/scala-in-action-nilanjan-raychaudhuri/
DSLs in Action Debasish Ghosh
https://ebookfinal.com/download/dsls-in-action-debasish-ghosh/
Camel in Action Claus Ibsen
https://ebookfinal.com/download/camel-in-action-claus-ibsen/
Earth First Direct Action Manual 3rd Edition Earth First!
https://ebookfinal.com/download/earth-first-direct-action-manual-3rd-
edition-earth-first/
Grails in Action 1st Edition Glen Smith
https://ebookfinal.com/download/grails-in-action-1st-edition-glen-
smith/
Lucene in Action 2nd Edition Michael Mccandless
https://ebookfinal.com/download/lucene-in-action-2nd-edition-michael-
mccandless/
Psychology in Action Ninth Edition Karen Huffman
https://ebookfinal.com/download/psychology-in-action-ninth-edition-
karen-huffman/
Kafka in Action 1st Edition Dylan Scott
https://ebookfinal.com/download/kafka-in-action-1st-edition-dylan-
scott/
WebWork in Action In Action First Edition Patrick Lightbody
WebWork in Action In Action First Edition Patrick
Lightbody Digital Instant Download
Author(s): Patrick Lightbody, Jason Carreira
ISBN(s): 9781932394641, 1932394648
Edition: First Edition
File Details: PDF, 5.39 MB
Year: 2005
Language: english
WebWork in Action In Action First Edition Patrick Lightbody
WebWork in Action
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
WebWork in Action
PATRICK LIGHTBODY
JASON CARREIRA
M A N N I N G
Greenwich
(74° w. long.)
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in
quantity. For more information, please contact:
Special Sales Department
Manning Publications Co.
209 Bruce Park Avenue Fax:(203) 661-9018
Greenwich, CT 06830 email: manning@manning.com
©2006 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by means electronic, mechanical, photocopying, or otherwise, without
prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books they publish printed on acid-free paper, and we exert our best efforts to that end.
Manning Publications Co. Copyeditor: Tiffany Taylor
209 Bruce Park Avenue Typesetter: Gordan Salinovic
Greenwich, CT 06830 Cover designer: Leslie Haimes
ISBN 1-394932-53-2
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – VHG – 10 09 08 07 06 05
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
v
brief contents
PART 1 INTRODUCTION TO WEBWORK ................... 1
Chapter 1 ■ An overview of WebWork 3
Chapter 2 ■ HelloWorld, the WebWork way 19
Chapter 3 ■ Setting up WebWork 38
PART 2 CORE CONCEPTS....................................... 75
Chapter 4 ■ Implementing WebWork actions 77
Chapter 5 ■ Adding functionality with interceptors 112
Chapter 6 ■ Inversion of Control 137
PART 3 DISPLAYING CONTENT ............................ 175
Chapter 7 ■ Using results 177
Chapter 8 ■ Getting data with the expression language 209
Chapter 9 ■ Tag libraries 230
Chapter 10 ■ Velocity 254
Chapter 11 ■ UI components 271
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
vi BRIEF CONTENTS
PART 4 ADVANCED TOPICS.................................. 311
Chapter 12 ■ Type conversion 313
Chapter 13 ■ Validating form data 333
Chapter 14 ■ Internationalization 360
Chapter 15 ■ Best practices 384
Appendix ■ WebWork architecture 424
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
vii
contents
foreword xv
preface xvii
acknowledgments xix
about this book xxi
a look at the future xxvi
about the title xxvii
about the cover illustration xxviii
PART 1 INTRODUCTION TO WEBWORK .........................1
1 An overview of WebWork 3
1.1 Why MVC is important 5
Classic MVC becomes outdated 6 ■ Classic MVC gets an update:
the Front Controller 7 ■ MVC evolves: the Page Controller 7
1.2 Understanding frameworks and containers 9
What is a framework? 9 ■ What a container can do 11
1.3 WebWork: past, present, and future 13
The history of WebWork 13 ■ Understanding the XWork core 13
Future directions 15
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
viii CONTENTS
1.4 The CaveatEmptor application 15
How CaveatEmptor is organized 16
1.5 Summary 17
2 HelloWorld, the WebWork way 19
2.1 Downloading WebWork 20
2.2 Preparing the skeleton 20
Creating the web.xml deployment file 21 ■ Creating the xwork.xml
configuration file 23 ■ Creating the webwork.properties
configuration file 23 ■ Tips for developing WebWork apps 24
2.3 Your first action 24
Saying hello, the WebWork way 25 ■ Displaying output to
the web browser 26 ■ Configuring your new action 27
2.4 Dealing with inputs 28
2.5 Advanced control flow 31
2.6 Letting WebWork do the work 33
Taking advantage of ActionSupport 34 ■ Intermediate modifications
to the JSP 35 ■ Exploring the UI tag library 36
2.7 Summary 37
3 Setting up WebWork 38
3.1 Configuring actions, results, and interceptors 39
Overview of terminology 39 ■ Actions 40
Results 46 ■ Interceptors 48
3.2 Advanced configuration 52
The xwork.xml DTD 52 ■ Namespaces and packages 53
Componentization using the include tag 57
3.3 Other configuration files 66
Web-app configuration: web.xml 66
Feature configuration: webwork.properties 67
3.4 Setting up your web app 70
General layout 70 ■ Required libraries 71 ■ Optional libraries 72
3.5 Summary 72
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
CONTENTS ix
PART 2 CORE CONCEPTS ............................................ 75
4 Implementing WebWork actions 77
4.1 The Action interface 78
Result codes 78 ■ Handling exceptions 79
4.2 Using the ActionSupport base class 80
4.3 Understanding basic validation 80
Validating an action: Validateable 81
Displaying error messages: ValidationAware 82
4.4 Using localized message texts 86
Retrieving the user’s locale: LocaleProvider 86
Displaying the localized text: TextProvider 86
Providing messages for other languages 89
4.5 Advanced inputs 90
Intermediary objects 90 ■ Using domain objects directly 91
4.6 Working with ModelDriven actions 95
Implementing ModelDriven actions 96
Considerations when using ModelDriven 100
4.7 Accessing data through the ActionContext 102
CaveatEmptor: accessing the session 102
Example: accessing the request and response 105
4.8 Handling file uploads 107
Accessing uploaded files through the request wrapper 107
Automating file uploads 109 ■ Configuration settings 110
4.9 Summary 111
5 Adding functionality with interceptors 112
5.1 How interceptors are called 113
5.2 Using the prepackaged interceptors 114
Utility interceptors 117 ■ Setting parameters 119
Defining workflow 123
5.3 Using prepackaged interceptor stacks 126
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
x CONTENTS
5.4 Building your own interceptors 128
Using the AroundInterceptor as a base 129 ■ Looking at an example
custom interceptor 130 ■ Getting callbacks before the result is
executed with the PreResultListener 133 ■ Looking out for
interceptor interactions 134
5.5 Interceptors vs. servlet filters 135
5.6 Summary 136
6 Inversion of Control 137
6.1 Examining the pattern 138
Common patterns for active resource management 138 ■ Inverting
resource management 142 ■ How IoC helps with testing 145
6.2 IoC essentials 146
WebWork’s IoC history 146 ■ Dependencies 148
Scope and lifecycle 149
6.3 Using WebWork’s IoC framework 151
Configuration 151 ■ Creating a new component 154 ■ Using IoC
on any object 158 ■ Dealing with complex dependencies 159
6.4 An example from CaveatEmptor 162
The HibernateSessionFactory component 163 ■ The Persistence
Manager component 165 ■ Configuring the components 168
Using the new components 169
6.5 Alternatives 170
Alternative IoC containers 170 ■ Non-IoC alternatives 172
6.6 Summary 173
PART 3 DISPLAYING CONTENT ..................................175
7 Using results 177
7.1 Life after the action 178
A simple result 178 ■ Configuring a result 180
7.2 Common results 182
Dispatching to a page 182 ■ Redirecting to a page 188
Chaining to another action 192
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
CONTENTS xi
7.3 Other results 197
Streaming Velocity templates directly to the output 197
FreeMarker: an alternative to Velocity 202
Generating reports with JasperReports 203
7.4 Summary 207
8 Getting data with the expression language 209
8.1 What is an expression language? 210
Why an expression language? 210 ■ Why OGNL? 211
Other expression languages 212 ■ Key OGNL concepts 213
8.2 Basic expression language features 213
Accessing bean properties 214 ■ Literals and operators 215
Calling methods 217 ■ Setting values and expression lists 218
Accessing static methods and fields 218 ■ Accessing the OGNL
context and the ActionContext 218
8.3 Working with collections 220
Working with lists and arrays 220 ■ Working with maps 221
Filtering and projecting collections 222 ■ The multiple uses
of “#” 223
8.4 Advanced expression language features 224
Linking the value stack to the expression language 224
Data type conversion 226 ■ Handling null property access 227
Creating lambda expressions on the fly 228
8.5 Summary 228
9 Tag libraries 230
9.1 Getting started 231
9.2 An overview of WebWork tags 232
The WebWork tag syntax 233
9.3 Data tags 235
The property tag 235 ■ The set tag 236 ■ The push tag 237
The bean tag 238 ■ The action tag 240
9.4 Control tags 242
The iterator tag 242 ■ The if and else tags 245
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xii CONTENTS
9.5 Miscellaneous tags 246
The include tag 246 ■ The URL tag 247 ■ The i18n
and text tags 250 ■ The param tag 252
9.6 Summary 253
10 Velocity 254
10.1 Introduction to Velocity 255
What is Velocity? 255 ■ Getting ready to use Velocity 257
10.2 Basic syntax and operations 259
Property access 259 ■ Method calls 261 ■ Control statements:
if/else and loops 261 ■ Assigning variables 265
10.3 Advanced techniques 265
The VelocityContext 265 ■ WebWork-supplied objects in
the context 266 ■ Customizing the Velocity context 267
10.4 Using JSP tags in Velocity 268
10.5 Loading Velocity templates 269
10.6 Summary 269
11 UI components 271
11.1 Why bother with UI tags? 272
Eliminating the pain 272 ■ More than just form elements 280
11.2 UI tag overview 283
Templates 283 ■ Themes 285 ■ Tag attributes 291
11.3 UI tag reference 291
Common attributes 291 ■ Simple tags 294
Collection-based tags 299 ■ Advanced tags 305
11.4 Summary 309
PART 4 ADVANCED TOPICS ........................................311
12 Type conversion 313
12.1 Why type conversion? 314
The Servlet specification 314 ■ An action without type
conversion 315 ■ A view without type conversion 317
What WebWork’s type conversion gives you 319
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
CONTENTS xiii
12.2 Configuration 320
Role of a type converter 321 ■ Global type converters 322
Class-level type converters 322
12.3 Simple type conversion 323
Basic type conversion 323 ■ Built-in type conversion 325
Handling null property access 326
12.4 Advanced topics 326
Handling null Collection access 326 ■ Handling conversion
errors 329 ■ An example that puts it all together 330
12.5 Summary 331
13 Validating form data 333
13.1 Manually validating data 336
Validating in the execute() method 336
Implementing the Validateable interface 337
13.2 Using the Validation Framework 340
Building your first *-validation.xml file 340 ■ Registering
validators 341 ■ Applying the validation interceptor 345 ■ Pulling
it all together 346 ■ Looking at some validation XML examples 348
13.3 Exploring the advanced features
of the Validation Framework 350
Implementing a custom validator 351 ■ Validating with
different contexts 353 ■ Short-circuiting validation 354
The ExpressionValidator 355 ■ Reusing validations with
the visitor field validator 356
13.4 Summary 359
14 Internationalization 360
14.1 Exploring a quick internationalization example 361
14.2 Sources for messages 362
Understanding the ResourceBundle search order 364 ■ Adding
default resource bundles 366 ■ The <ww:i18n> tag 366
14.3 Using internationalized messages 368
Parameterizing localized texts 368 ■ Using getText() in taglib
attributes 369 ■ Formatting dates and numbers 370 ■ Using
localized messages in validations 370 ■ Using internationalized
texts for type conversion messages 371
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xiv CONTENTS
14.4 Tips and tricks 373
Programmatically setting the locale 373 ■ Implementing Resource-
Bundles as classes 375 ■ Using the <ww:param> tag to pass
dynamically generated text to message texts 378 ■ Setting the
encoding: here, there, and everywhere 381 ■ A note on Java
PropertyResourceBundles 382 ■ A final note 382
14.5 Summary 383
15 Best practices 384
15.1 Setting up your environment 385
Setting up your IDE 386 ■ Reloading resources 388
15.2 Unit-testing your actions 389
Using mock objects 389 ■ The advantage of IoC for testing 391
Handling statics and ThreadLocals 391
15.3 Putting the pieces together: integration testing 393
Testing your configuration 393
Seeing the configuration with the config browser 396
15.4 Testing validations 398
Testing programmatic validations 398
Testing validation.xml files 398
15.5 Advanced UI tag usage 402
Overriding existing templates 403 ■ Writing custom templates 406
Writing custom themes 407
15.6 Using form tokens to prevent
duplicate form submissions 409
Using the <ww:token> tag 410 ■ Applying the
TokenInterceptor 412 ■ Transparently re-rendering
pages with the TokenSessionStoreInterceptor 413
15.7 Displaying wait pages automatically 413
15.8 A Single action for CRUD operations 417
Creating new categories with newCategory 418 ■ Reading and
updating with viewCategory and editCategory 419 ■ Saving catego-
ries with saveCategory 420 ■ Setting the parentCategory 422
15.9 Summary 423
appendix WebWork architecture 424
index 439
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xv
foreword
Building a framework is difficult. On the one hand, the framework needs to be
flexible enough to cater to a wide variety of needs; on the other hand, it needs to
be solid enough that it doesn’t fall prey to the beast of complexity—the urge to
make it the solution to conquer all other solutions. In today’s development envi-
ronment, a multitude of frameworks is available to help you deal with various
aspects of creating complex and useful enterprise software. Each framework pro-
vides something unique that makes it cover its particular field of application in a
(more or less) human-friendly manner; in addition, each framework must work
within its boundaries, relating to other frameworks in a software ecology that is
constantly changing as needs and requirements change.
In order to accomplish this seemingly impossible task, it is necessary to acknowl-
edge and study past efforts that a framework is supposed to replace and/or extend.
In the case of WebWork, there were, and still are, a number of different approaches
and frameworks that I looked at before I set to work. The idea was to create a new
framework that allowed developers to get their job done with as little work as pos-
sible and perform each task efficiently without needing an unnecessarily complex
framework to work against. Simple things should be simple to do while allowing
complex things to be possible.
Another important aspect of WebWork is that it should allow developers as
much freedom as possible to use other technologies—for example, to render out-
put. A number of rendering alternatives are available, and it’s impossible—and
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xvi FOREWORD
futile—to determine which one is best in all situations; such an alternative simply
doesn’t, and can’t, exist. Being open minded in this regard is crucial, and it has
paid off: WebWork has now been successfully integrated with a wide variety of ren-
dering technologies, including some that don’t target HTML or the Web. It has
grown beyond its initial purpose, which is always gratifying for a parent.
WebWork started as an itch that I needed to personally scratch. However, with
its second generation it has expanded into a fully grown community project,
where developers add and improve WebWork by leveraging the structure pro-
vided by the framework. No framework of this kind, in today’s competitive envi-
ronment, can be successful without the input and ideas of a multitude of
developers, because it’s important that it be able to handle the real issues that
people face in their daily work. As a result, WebWork now has a life of its own and
is growing steadily as a community effort.
A book covering such a framework needs to be able to deal with all the intrica-
cies of framework construction and convey the reasoning behind why it works the
way it does; it must also demonstrate in action how all the theoretical stuff works in
practice. Theory has no point if it ain’t practically applicable. This book explains
in reasonable detail the rationale for how WebWork is constructed, but it’s mainly
focused on showing you in practical terms how to use WebWork, from the simple
to the complex. Time is always of the essence, and this book is a great investment
if you’re interested in learning about web framework construction, or if you want
to make a killer web app that blows everyone’s mind. Anything is possible!
RICKARD ÖBERG
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xvii
preface
It’s been almost 10 years since I developed my first web-based application. The
program was a simple online shopping cart written in Perl. I still have the code
lying around, and I look at it occasionally—I do this to remind myself of where I
was and to keep myself focused on where I want to go. The application was horri-
ble. It consisted of one extremely large Perl file (over 10,000 lines!), and it
printed out HTML using lots of print statements. Looking at it today, it’s impossi-
ble for me to understand.
And yet, 10 years ago, I managed to put together something that not only was
functional but also made sense to me. This growth is typical of what most profes-
sional developers go through, Jason and me included. The “hacks” I wrote made
sense at the time, but as the months and years went on, the code became a rat’s
nest and maintenance was a nightmare. This problem is bad enough when you’re
developing non-GUI programs, but it’s worse when bad code that handles business
logic is mixed with bad code that handles the GUI. And it’s even worse when your
GUI is written in HTML, and you’re relying on linearly spitting out HTML tags
instead of using object orientation or componentization.
Why is this important? Because, like all other developers, Jason and I have
grown from novice programmers hacking in Perl and PHP (and not really know-
ing what we were doing) to experienced developers with a deep understanding of
what it takes to build a maintainable web-based application.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xviii PREFACE
Jason and I didn’t create WebWork. It was developed by Rickard Öberg, one of
the original authors of JBoss, after he decided there had to be a better way to
develop web applications. What came from Rickard was a framework built around
the philosophy that the correct way to do something should also be the easiest
option, that the path of least resistance is a good thing, and that there is a fine bal-
ance between too much flexibility and too little.
Jason and I found WebWork through different means, but the end result was
the same: We were captivated by its functionality and grace. Over time, we evolved
from users to contributors to developers, and now to published authors. In the
process, we’ve learned better ways to do things. And similarly, WebWork has also
evolved. Jason and I spent endless nights creating version 2.0, which has become a
major upgrade and has set the groundwork for doing much more with the Web-
Work platform.
Today, WebWork is much more than it was in the past. And tomorrow, it will be
even better. In this book, you’ll learn the techniques, best practices, and concepts
that go with the WebWork framework. You’ll see why we spent so much energy on
type conversion and how it relates to HTTP. You’ll learn about how common chal-
lenges in the world of HTML (such as the double-submit problem) were solved
using interceptors—a feature unique to WebWork. You’ll understand why build-
ing reusable templates that generate HTML is the best way to quickly create main-
tainable web applications.
Mostly, though, you’ll learn a better way to build web applications. Whether
you’re already a WebWork user, or you use an alternative Java framework, or you
don’t use Java at all, this book provides the concepts and techniques that are the
foundation of WebWork. We hope this book serves as a WebWork reference and
also as a great tool for sharpening your development skills.
PATRICK LIGHTBODY
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xix
acknowledgments
This book wouldn’t have been possible if it weren’t for the tremendous community
at OpenSymphony and all the software developers who continue to push for inno-
vation in the Java web space. To everyone who uses WebWork or other OpenSym-
phony projects: Thank you for the appreciation and support through the years;
with this book we’ll continue to drive innovation even further.
Of course, this book also couldn’t have been possible without a publisher. To
everyone at Manning, thank you for believing in us and in WebWork. This experi-
ence has been the most fulfilling project we’ve ever completed. We’d like to rec-
ognize the tireless efforts of our editor, Jackie Carter. As we closed in on the final
weeks and months, we couldn’t have pulled it off without the amazing proofread-
ing, editing, marketing, and coordination provided by Liz Welch, Tiffany Taylor,
Karen Tegtmeyer, and Mary Piergies. And finally, thank you to Marjan Bace for
having the faith that, even through delays and setbacks, Manning could offer a
book that would benefit so many software developers.
We also want to make a special mention of Carlos Whitt, who, with little notice,
was kind enough to step in and take on the role of technical editor at the last
minute. Thanks to Carlos’s diving catch, we received valuable feedback and
insightful comments. Carlos, your input was more valuable than we can possibly
describe. Thank you. In addition to Carlos’s heroic effort, we want to thank each
and every reviewer who provided feedback during the entire process: Jack Her-
rington, Drew McAuliffe, Bill Lynch, Dick Zetterberg, Steve Poll, Ryan Daigle,
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xx ACKNOWLEDGMENTS
Peter White, Luigi Viggiano, Matthew Payne, Joseph B. Ottinger, Hani Suilman,
Mark Woon, Berndt Hamboeck, Andrew Oswald, and Dag Liodden. Your feed-
back led to some major changes in how this book was structured, and we’re for-
ever in your debt for your wisdom. Finally, special thanks and words of
appreciation to Rickard Öberg for agreeing to write the foreword to our book.
Patrick would also like to thank all his coworkers at Cisco Systems, Spoke Soft-
ware, and Jive Software. Without their support, both verbal and technical, he
could never have invested the time and energy in a project like WebWork and
would certainly have never written a book on the subject. He also thanks his
friends and family, who, no matter how much of a hermit he became, stood by his
side through the entire process. And finally, many thanks to his girlfriend and
best friend, Megan. Without her honesty, encouragement, and love, this book
would never have been realized.
Jason would first and foremost like to thank his wife, Cyndy, without whose
love, support, and nagging, his work on WebWork and this book would not have
been possible. He would also like to thank his children, who had to spend too
much time watching their dad work on his laptop instead of playing with them.
He’d like to thank his former coworkers at Notiva and current coworkers at ePlus,
whose wise decision to use WebWork allowed him to put theory to practice in cre-
ating great web applications. Finally, he’d like to thank Patrick for picking up his
slack at the end when the real world intruded too heavily.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xxi
about this book
This book is very much what the title says: a book about working on web-based appli-
cations, using real-world examples along the way. That’s what WebWork empha-
sizes: working on your project, not wrestling with your framework. Although it isn’t
the most-used web framework in the Java world, WebWork is widely known as the
most refined, and it’s gaining momentum every day. We’ll show you how you can
stop wrestling and get your framework to begin working for you.
In this book, we’ll walk you through the basics of writing web applications,
starting with simple forms and form processing. However, we know you’ve proba-
bly done that stuff a million times, and you’re looking to sink your teeth into
meatier problems. As such, we quicken the pace and look at advanced features
such as validation, data-type conversion, resource dependencies, loose coupling
of web application components, and a treasure chest of ways to deal with common
challenges unique to the Web.
This book stays focused on a single application: CaveatEmptor. This is a modi-
fied version of the same application used in Hibernate in Action (Christian Bauer
and Gavin King, Manning, 2004). By focusing on a tangible, growing application
that you can download and modify, you get the benefit of taking part of an evolu-
tionary process that goes beyond the pages of this book. You can expect that for
the years following the publication of this book, the CaveatEmptor application
will continue to lead the way for showcasing best practices for common web- and
persistence-related problems.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xxii ABOUT THIS BOOK
Roadmap
Chapter 1 provides a basic overview required to help you get started with Web-
Work. In addition to answering the hows, whys, and whats, we compare WebWork
to other frameworks and outline the philosophy set by Rickard Öberg when he
first created WebWork.
In chapter 2, we run through several iterations of a basic “Hello, World” appli-
cation, starting from an extremely simple read-only example and going all the way
to a more advanced input workflow complete with data validation and error
reporting.
In chapter 3, we begin to look at the configuration options WebWork provides.
This chapter covers how to configure individual actions, interceptors, and results,
as well as general framework-related options such as what URL pattern to bind to.
Chapter 4 improves on the configuration lessons and hands-on experience
from the previous two chapters and provides concrete examples of how to create
your own WebWork actions. In this chapter we dive deeper into the basic form val-
idation, error handling, and localization provided by the ActionSupport base
class. We also look at handling alternative data elements in your actions, such as
file uploads.
By this point, you’ll be comfortable writing applications in WebWork. In the
remaining chapters, our goal is to help you use the advanced WebWork features
that were created to address everyday problems. In chapter 5, we explore inter-
ceptors and how they can add behavior to your actions without your needing to
change the action classes or subclass.
Chapter 6 explores the Inversion of Control (IoC) pattern and how WebWork
provides native support for it while also integrating into other popular IoC frame-
works, such as Spring.
At this point, we shift gears and begin to focus on issues relating to user inter-
faces. We begin by looking at the concept of results in chapter 7. Results include
common technologies like JSP but also uncommon ones: template languages such
as Velocity and FreeMarker, and reporting engines such as JasperReports.
Displaying results isn’t very useful if you can’t include your data. In chapter 8,
we take an in-depth look at Object Graph Navigation Language (OGNL): Web-
Work’s de facto expression language (EL). We also look at how EL shortcuts can
save you a ton of time when you’re rendering web-based forms.
Chapter 9 covers all the utility JSP tags that come with WebWork, from the
familiar (if/elseif/else) to the unfamiliar (push, pop, action, and set). Even if
you choose to develop in a template language such as FreeMarker rather than in
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
ABOUT THIS BOOK xxiii
JSP, this chapter is still important, because similar concepts exist in those other
technologies.
Now we’ll be almost ready to look at the other half of the JSP tags: the UI tags.
However, because they’re implemented in Velocity, we spend chapter 10 present-
ing the basics so that you’re well prepared. Chapter 10 is also a good way for you
to get up to speed on JSP alternatives.
In chapter 11, we look at one of the most important features in WebWork: the
UI tags. These tags let you componentize your HTML elements in to easy-to-reuse
pieces. Building maintainable and scalable web applications hinges on use of
these tags.
Chapter 12 examines common issues of type conversion—a challenge all web
developers face, regardless of what programming language you’re using. That’s
because HTTP is untyped, meaning all inputs are effectively Strings.
Chapter 13 looks at advanced validation techniques, focusing on ways to get
data validation logic away from your code data manipulation logic.
Chapter 14 discusses techniques and features related to internationalization
(i18), also known as localization.
Finally, in chapter 15, we pull it all together and look at common problems
in the web environment and how everything you’ve learned can solve them. We
take on the double-submit problem many web developers have faced. We also
look at innovative ways to handle long-running processes rather than just asking
the user to please wait. In addition to these common problems, we explore test-
ing and debugging techniques that are useful when you’re building WebWork-
powered applications.
Who should read this book?
This book is for anyone who’s fed up with web development, or at least wondering
if there’s a better way. Specifically, we expect that readers have a basic understand-
ing of Java and the commonly used Java APIs, such as the Java Collections API.
Because WebWork is all about the Web, a minimum level of understanding of
HTML, JavaScript, and CSS is required.
Those who don’t work on the web portion of their applications but have
coworkers who do are also encouraged to read this book. With advanced features
like type conversion, WebWork shows that you may not have to compromise on
the design of your application’s API just to appease the framework the web devel-
opers use.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xxiv ABOUT THIS BOOK
Our hope is that both novice and experienced software developers—even
those who aren’t from a primarily Java-based background—can pick up this book
and be productive right away.
Code conventions and downloads
This book provides many examples in various formats found in web applications
powered by WebWork: Java code, HTML, XML snippets, JSPs, and template files
written in Velocity. All source code in listings or in text is in a fixed-width font
like this to separate it from ordinary text. Additionally, Java method names, Java-
Bean properties, XML elements, and attributes in text are presented using this
same font.
Java, HTML, and XML can be verbose. In many cases, the original source code
(available online) has been reformatted; we’ve added line breaks and reworked
indentation to accommodate the available page space in the book. In rare cases
even this was not enough, and listings include line-continuation markers. Addi-
tionally, many comments and JavaBean setters and getters have been removed
from the listings.
Code annotations accompany some of the source code listings, highlighting
important concepts. In a few cases, numbered bullets link to explanations that fol-
low the listing.
WebWork is an open source project released under the very liberal OpenSym-
phony License. Directions for downloading WebWork, in source or binary form, are
available from the WebWork web site: http://www.opensymphony.com/webwork.
The source code for all the CaveatEmptor examples in this book is available from
http://www.manning.com/lightbody. The CaveatEmptor example application is a
derivativeoftheoneusedinHibernateinAction,foundathttp://caveatemptor.hiber-
nate.org. You can find many versions of CaveatEmptor, using various deployment
techniques (EJB, non-EJB), but the one found at the Manning web site should be
the one you use as the companion to this book. Once you’re finished reading the
book, we highly recommend taking a peak at other versions of CaveatEmptor if
you’re at all curious about Hibernate or future versions of WebWork.
Author Online
Purchase of WebWork in Action includes free access to a private web forum run by
Manning Publications where you can make comments about the book, ask techni-
cal questions, and receive help from the author and from other users. To access
the forum and subscribe to it, point your web browser to http://www.man-
ning.com/lightbody. This page provides information on how to get on the forum
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
ABOUT THIS BOOK xxv
once you are registered, what kind of help is available, and the rules of conduct
on the forum.
Manning’s commitment to our readers is to provide a venue where a meaning-
ful dialog between individual readers and between readers and the authors can
take place. It is not a commitment to any specific amount of participation on the
part of the authors, whose contribution to the AO remains voluntary (and
unpaid). We suggest you try asking the authors some challenging questions lest
their interest stray!
The Author Online forum and the archives of previous discussions will be
accessible from the publisher’s web site as long as the book is in print.
About the authors
PATRICK LIGHTBODY Heading up Jive Software's Professional Services organiza-
tion, Patrick has worked for various technology companies, ranging from well-estab-
lished giants such as Cisco Systems to tiny Silicon Valley startups. He is the author
of Java Open Source Programming and spends his spare time contributing to var-
ious OpenSymphony projects, including WebWork and OSWorkflow. While he
grew up in the heart of the Silicon Valley, Patrick now resides in Portland, Oregon.
JASON CARREIRA Jason has been developing and architecting J2EE applications
for six years. For the last five, he’s been designing and building enterprise finan-
cial software products from the ground up. He recently joined ePlus where he is
working on the next generation of eProcurement solutions. In his spare time,
Jason is a core developer of the XWork command pattern framework and Web-
Work MVC web framework at OpenSymphony. He lives in Rochester, New York,
with his wife Cyndy and three children.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xxvi
a look at the future
In the open source world, innovation never stops. Although this can be a great
thing, it can make it terribly difficult for people to keep up—even more so in the
printed media. When we began working on this book over a year ago, WebWork 2.1
was just coming out and had huge momentum behind it. Today, WebWork 2.2 is just
around the corner, and many new things are coming with it.
With that in mind, we specifically focused this book on things we knew would be
important no matter what version of WebWork you’re using—or even if you aren’t
using WebWork at all. The concepts and techniques introduced here—such as
decoupled validation and type conversion—are important in any web environment.
This book is based on WebWork 2.1.7, but we took several steps to prepare you
for the upgrade to 2.2. Most important, we use the optional altSyntax feature in
WebWork 2.1.7 that will become standard in 2.2 and beyond. This feature simpli-
fies how the tag libraries work. Because this feature was optional in 2.1, it’s
extremely important that you enable it before attempting to use any of the exam-
ples in this book. In chapter 3, “Setting up WebWork,” we show you how to enable
this feature.
Another step we took to make sure concepts learned here can be taken beyond
the pages of this book is to use derivative of the sample application used in Hiber-
nate in Action. Both the Hibernate and WebWork teams have committed to
improving and evolving CaveatEmptor; so, after you’re finished reading this book,
you can look at new versions of CaveatEmptor to see how the same application
was built using WebWork 2.2 features.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xxvii
about the title
By combining introductions, overviews, and how-to examples, the In Action books
are designed to help learning and remembering. According to research in cogni-
tive science, the things people remember are things they discover during self-
motivated exploration.
Although no one at Manning is a cognitive scientist, we are convinced that for
learning to become permanent it must pass through stages of exploration, play,
and, interestingly, retelling of what is being learned. People understand and
remember new things, which is to say they master them, only after actively explor-
ing them. Humans learn in action. An essential part of an In Action guide is that it
is example-driven. It encourages the reader to try things out, to play with new
code, and explore new ideas.
There is another, more mundane, reason for the title of this book: our readers
are busy. They use books to do a job or to solve a problem. They need books that
allow them to jump in and jump out easily and learn just what they want just when
they want it. They need books that aid them in action. The books in this series are
designed for such readers.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
xxviii
about the cover illustration
The figure on the cover of WebWork in Action is a “Dancer from Constantinople.”
The illustration is taken from a collection of costumes of the Ottoman Empire
published on January 1, 1802, by William Miller of Old Bond Street, London. The
title page is missing from the collection and we have been unable to track it down
to date. The book’s table of contents identifies the figures in both English and
French, and each illustration bears the names of two artists who worked on it,
both of whom would no doubt be surprised to find their art gracing the front
cover of a computer programming book...two hundred years later.
The collection was purchased by a Manning editor at an antiquarian flea mar-
ket in the “Garage” on West 26th Street in Manhattan. The seller was an American
based in Ankara, Turkey, and the transaction took place just as he was packing up
his stand for the day. The Manning editor did not have on his person the substan-
tial amount of cash that was required for the purchase and a credit card and
check were both politely turned down.
With the seller flying back to Ankara that evening the situation was getting
hopeless. What was the solution? It turned out to be nothing more than an old-
fashioned verbal agreement sealed with a handshake. The seller simply proposed
that the money be transferred to him by wire and the editor walked out with the
bank information on a piece of paper and the portfolio of images under his arm.
Needless to say, we transferred the funds the next day, and we remain grateful and
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
ABOUT THE COVER ILLUSTRATION xxix
impressed by this unknown person’s trust in one of us. It recalls something that
might have happened a long time ago.
The pictures from the Ottoman collection, like the other illustrations that
appear on our covers, bring to life the richness and variety of dress customs of two
centuries ago. They recall the sense of isolation and distance of that period‹and of
every other historic period except our own hyperkinetic present.
Dress codes have changed since then and the diversity by region, so rich at the
time, has faded away. It is now often hard to tell the inhabitant of one continent
from another. Perhaps, trying to view it optimistically, we have traded a cultural
and visual diversity for a more varied personal life. Or a more varied and interest-
ing intellectual and technical life.
We at Manning celebrate the inventiveness, the initiative, and, yes, the fun of
the computer business with book covers based on the rich diversity of regional life
of two centuries ago, brought back to life by the pictures from this collection.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Part 1
Introduction to WebWork
This part of the book eases you into the basics of WebWork and the problems it
tries to solve. Chapter 1 looks at the high-level architecture of WebWork and why
the Model-View Controller design pattern helps when you’re building web appli-
cations. In chapter 2, we apply these concepts in a concrete manner and walk you
through the creation of a simple read-only WebWork example. We then modify
that example and add data input and validation and the corresponding page
workflow. Once you’re comfortable building basic web apps, we examine the vari-
ous forms of configuration you can use to build your own applications.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
3
An overview of WebWork
This chapter covers
■ Why MVC is important
■ Frameworks and containers
■ WebWork’s background and future
■ The CaveatEmptor sample application
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
4 CHAPTER 1
An overview of WebWork
Imagine you just built an entire web application and shipped version 1.0. Your
biggest customer is now demanding that in version 1.1, the user interface must
change dramatically to fit with their corporate usability standards—everything
from the number of fields in data-entry forms to button and image locations to
the number of steps in various wizards. And the customer wants the changes made
by next week.
Depending on how your web application was built, you might not even break a
sweat. Or, you might be beefing up your resume. In the early days of building web
applications, developers often used scripting languages like Perl and printed out
content they wanted to display directly within their scripts—the same place where
critical business logic was located. It soon became clear that this technique too
tightly coupled the core business code with the presentation.
These days, libraries exist for Perl, PHP, JSP, ASP, and every other web-enabled pro-
gramming language, to try to solve the problem of separating business code from
presentation code. Depending on the library you use and how well you’ve taken
advantage of it, fulfilling your customer’s demands might be a walk in the park.
In this book, you’ll learn how to use one of Java’s most popular web frame-
works: WebWork. WebWork is an advanced framework based on the philosophy
that common tasks should be easy to do and advanced designs should be possible
to build. More than anything, the developers of WebWork wanted to provide a
framework that works for you, not against you.
To help you learn WebWork, we’ll show you how we utilized its basic and
advanced features to build a second-generation version of the sample application
used in the book Hibernate in Action (Manning Publications, 2004, www.man-
ning.com/bauer). Hibernate is an Object-Relational Mapping (ORM) framework
that provides easy database access. The authors, Christian Bauer and Gavin King,
demonstrated the features of Hibernate using an online auction application
named CaveatEmptor. Although CaveatEmptor is a complete application, it lacks
any sort of web-based interface.
In this book, we’ll demonstrate how we used the features of WebWork to add a
web front end on top of the original CaveatEmptor code. We chose to introduce
WebWork and its features this way for several reasons. First, many WebWork users
also use Hibernate, so expanding on CaveatEmptor allows the community to see
optimal ways to integrate the two. In addition, the original CaveatEmptor applica-
tion contains no web user interface, and many readers of Hibernate in Action might
want to learn how to add one. Those who know how to write back-end code quite
well but aren’t experts with the front end can consult this book to see how it’s done.
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Why MVC is important 5
However, before we can explore WebWork’s features and CaveatEmptor, we’ll
first examine the general ideas behind web application frameworks. In chapter 2,
“HelloWorld, the WebWork way,” we’ll walk through the familiar “Hello, World”
tutorial to show you the basics of using WebWork. For the remainder of the book,
we’ll focus entirely on WebWork’s features and how we used them in the
CaveatEmptor application.
But before we can do that, you need to understand what WebWork is and what
it’s trying to accomplish. At the core, WebWork solves the problem of separating
presentation logic from domain logic. But what does that mean? Why is it impor-
tant? Where did this concept come from? More to the point, what is MVC, the pat-
tern on which WebWork is based?
1.1 Why MVC is important
The issue of separating the domain model from presentation isn’t unique to web
applications. The Model-View-Controller (MVC) pattern was originally developed by
the SmallTalk community to solve this problem for desktop GUI applications. MVC
seeks to break an application into three parts and define the interactions between
these components, thereby limiting the coupling between them and allowing each
one to focus on its specific responsibilities without worrying about the others.
Although the original MVC pattern worked well for desktop GUI applications,
it failed to map directly to the World Wide Web. As developers continued to refine
their web development techniques, MVC variations evolved to address the behav-
iors specific to the request/response model that makes up the HyperText Trans-
port Protocol (HTTP). The core concerns of MVC haven’t changed as these
evolutions have taken place, and WebWork continues to champion the same moti-
vations that SmallTalk developers faced decades ago.
MVC tries to keep the more generally reusable domain model code and the
view-specific code from being too aware of each other. It does this by introducing
a controller to sit between the view and the model. The controller handles events
from the view, such as button clicks, and maps them to model changes. The con-
troller also registers the view to receive notifications of changes to the domain
model, so that the view can refresh. This allows, for instance, a different view to be
applied without changing the underlying model or controller layers.
MVC frameworks have become the dominant architecture for web application
development. WebWork is an MVC framework. Other popular Java-based MVC web
application frameworks include Struts (no longer in active development), Tapes-
try, RIFE, and JavaServer Faces (JSF). Before we look at web-based MVC designs,
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
6 CHAPTER 1
An overview of WebWork
let’s briefly examine the original MVC design that was used for desktop GUI appli-
cations. Knowing the flow of the original MVC will help you understand the
importance of the changes and updates MVC has faced as it has been applied to
WebWork—and, specifically, as it’s implemented in WebWork.
1.1.1 Classic MVC becomes outdated
Figure 1.1 shows the event flow in classic MVC. The user interacts with the view,
filling in data and clicking buttons. The controller receives events from the view
and performs actions on the model, updating it with the data the user has pro-
vided. The view is notified of model-change events so that it can refresh from the
model, showing the result of their work back to the user. Multiple views and con-
trollers may be configured to use the same shared model by registering more
event listeners. This pattern works well for applications where the entire applica-
tion runs on the user’s machine and everything runs and is refreshed in real time.
The classic MVC pattern breaks down, however, in the Web world, where the view
is rendered in a browser on the client side while the controller and model are on
the server. Figure 1.1 shows a very clean design approach. Unfortunately, it
doesn’t work in the world of HTTP and HTML. Instead, web applications, using an
HTTP request/response model, require a very different dwesign that borrows its
name and some aspects from classic MVC.
Controller View
Model
View Event
Client
Refresh
View
State Change Eve
n
t
Change
M
o
d
e
l
Interact
Figure 1.1 Event flow for the classic MVC pattern
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Why MVC is important 7
1.1.2 Classic MVC gets an update: the Front Controller
In the web version of MVC, views
can’t make direct calls to controllers,
as shown in figure 1.1, but are
mapped based on web requests to
URLs. The view isn’t an object to be
updated, but a web page that is
redrawn only when the client makes a
new request. The model also can’t
notify the view about changes,
because it’s rendered in the user’s
browser on a different machine; so,
the view is forced to re-render every
time for all the latest data.
Figure 1.2 shows the event flow in
MVC as it’s applied to web application
frameworks. The classic application
of MVC to the Web world is imple-
mented using the Front Controller pat-
tern. This involves a dispatcher
(implemented as a servlet in Java web
MVC implementations) that maps
request URLs to command instances to be executed. The command instances,
which are actions in WebWork or Struts, interact with backend services of the sys-
tem, which can be generally grouped together as the model. The command
instance returns a return code after doing its processing, which is mapped to a
view (usually a web page template such as a JSP). The view is provided with the
controller and model to render for the user and often uses custom tag libraries to
easily access these values.
1.1.3 MVC evolves: the Page Controller
A somewhat different implementation of MVC has been popularized by frame-
works like Microsoft’s ASP.NET1
. Rather than have requests go through a dispatcher
to look up a controller to execute, the view is hit directly and calls its controller
before continuing to render. Although this pattern gives up some of the decoupled
nature of a more classic MVC implementation, it should gain in productivity and
tool support (especially in Microsoft Visual Studio). This type of development can
Controller
View
Model
Client
Dispatcher
Request
Render
Execute
Change
Model
Refres
h
View
Figure 1.2
Event flow for MVC in a web
application framework
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
8 CHAPTER 1
An overview of WebWork
also be supported by WebWork by using the <webwork:action> custom tag (see
chapter 9, “Tag libraries,” for a discussion of the WebWork tag library).
Front Controller versus Page Controller
Figures 1.3 and 1.4 show how a dashboard might be implemented differently using
the Front Controller or Page Controller design. The Page Controller may look
more modular due to the split of the X, Y, and Z responsibilities, but good use of
object-oriented design could allow for a modular Front Controller design as well.
If you’re familiar with Struts, the Front Controller pattern will look very familiar.
Even if you aren’t familiar with other web frameworks, this technique should seem
to be the most linear way to gather data and present it. However, some frame-
works are embracing the Page Controller, shown in figure 1.4, because of the way
it encourages encapsulation. Fortunately, WebWork supports both implementa-
tions, giving you the best of both worlds.
In our experience, frameworks can greatly increase your productivity. In order
to meet your customers’ requirements and be ready for all the challenges an
1
Microsoft has an interesting discussion of presentation tier design patterns at http://msdn.mi-
crosoft.com/practices/type/Patterns/Enterprise/EspWebPresentationPatterns/. They include both
the Page Controller and Front Controller patterns; but the Page Controller is built into their frame-
work, whereas a Front Controller implementation must be built from scratch.
Dashboard
Web
Browser XYZ Action
Request
Response
Push Push
Push
Figure 1.3 A dashboard implemented using the Front Controller MVC design
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Understanding frameworks and containers 9
ever-changing business world throws at you, we recommend that you take advantage
of the MVC design pattern when building web applications. Rather than build an
MVC framework from scratch, most developers choose to leverage an existing one,
such as WebWork.
1.2 Understanding frameworks and containers
WebWork is, at its very heart, an MVC framework. But it’s also a lightweight con-
tainer. To help you better understand the difference between a framework and a
container, we’re going to look at the functionality each one provides as well as sev-
eral alternative or related technologies for both categories.
1.2.1 What is a framework?
When he was building the original version of WebWork, Rickard Öberg (the cre-
ator of WebWork and co-founder of JBoss) said, “A framework’s power comes not
from what it allows, but from what it does not allow.” What Rickard meant
explains what a framework is: Frameworks are meant to bring structure to what
would otherwise be chaos. In the case of web application frameworks, the goal is
to encourage developers to use a supplied set of base classes and tag libraries,
thereby avoiding a potential mess of tangled JSPs.
view.jsp
Web
Browser
Y Action
Request
Z
Action
X
Action
Request
Request Request
Response
Response
Response
Response
Figure 1.4 A dashboard implemented using the Page Controller MVC design
Licensed to Shirong Chen <chenshirong2000@hotmail.com>
Exploring the Variety of Random
Documents with Different Content
All the while he spoke he exquisitely stroked the rounded tail, till it
seemed as if a slippery sort of fire came from it into his hands. And
his fingertips touched the two secret openings to her body, time after
time, with a soft little brush of fire.
"An' if tha shits an' if tha pisses, I'm glad. I don't want a woman as
couldna shit nor piss."
Connie could not help a sudden snort of astonished laughter, but he
went on unmoved.
"Tha'rt real, tha art! Tha'rt real, even a bit of a bitch. Here tha shits
an' here tha pisses: an' I lay my hand on 'em both an' like thee for it.
I like thee for it. Tha's got a proper, woman's arse, proud of itself. It's
none ashamed of itself, this isna."
He laid his hand close and firm over her secret places, in a kind of
close greeting.
"I like it," he said. "I like it! An' if I only lived ten minutes, an' stroked
thy arse an' got to know it, I should reckon I'd lived one life, sees ter!
Industrial system or not! Here's one o' my lifetimes."
She turned round and climbed into his lap, clinging to him. "Kiss me!"
she whispered.
And she knew the thought of their separation was latent in both their
minds, and at last she was sad.
She sat on his thighs, her head against his breast, and her ivory-
gleaming legs loosely apart, the fire glowing unequally upon them.
Sitting with his head dropped, he looked at the folds of her body in
the fireglow, and at the fleece of soft brown hair that hung down to a
point between her open thighs. He reached to the table behind, and
took up her bunch of flowers, still so wet that drops of rain fell on to
her.
"Flowers stops out of doors all weathers," he said. "They have no
houses."
"Not even a hut!" she murmured.
With quiet fingers he threaded a few forget-me-not flowers in the fine
brown fleece of the mount of Venus.
"There!" he said. "There's forget-me-nots in the right place!"
She looked down at the milky odd little flowers among the brown
maiden-hair at the lower tip of her body.
"Doesn't it look pretty!" she said.
"Pretty as life," he replied.
And he stuck a pink campion bud among the hair.
"There! That's me where you won't forget me! That's Moses in the
bulrushes."
"You don't mind, do you, that I'm going away?" she asked wistfully,
looking up into his face.
But his face was inscrutable, under the heavy brows. He kept it quite
blank.
"You do as you wish," he said.
And he spoke in good English.
"But I won't go if you don't wish it," she said, clinging to him.
There was silence. He leaned and put another piece of wood on the
fire. The flame glowed on his silent, abstracted face. She waited, but
he said nothing.
"Only I thought it would be a good way to begin a break with Clifford.
I do want a child. And it would give me a chance to, to—" she
resumed.
"To let them think a few lies," he said.
"Yes, that among other things. Do you want them to think the truth?"
"I don't care what they think."
"I do! I don't want them handling me with their unpleasant cold
minds, not while I'm still at Wragby. They can think what they like
when I'm finally gone."
He was silent.
"But Sir Clifford expects you to come back to him?"
"Oh, I must come back," she said: and there was silence.
"And would you have a child in Wragby?" he asked.
She closed her arm round his neck.
"If you wouldn't take me away, I should have to," she said.
"Take you where to?"
"Anywhere! away! But right away from Wragby."
"When?"
"Why, when I come back."
"But what's the good of coming back, doing the thing twice, if you're
once gone?" he said.
"Oh, I must come back. I've promised! I've promised so faithfully.
Besides, I come back to you, really."
"To your husband's gamekeeper?"
"I don't see that that matters," she said.
"No?" He mused a while. "And when would you think of going away
again, then; finally? When exactly?"
"Oh, I don't know. I'd come back from Venice. And then we'd prepare
everything."
"How prepare?"
"Oh, I'd tell Clifford. I'd have to tell him."
"Would you!"
He remained silent. She put her arms fast round his neck.
"Don't make it difficult for me," she pleaded.
"Make what difficult?"
"For me to go to Venice and arrange things."
A little smile, half a grin, flickered on his face.
"I don't make it difficult," he said. "I only want to find out just what you
are after. But you don't really know yourself. You want to take time:
get away and look at it. I don't blame you. I think you're wise. You
may prefer to stay mistress of Wragby. I don't blame you. I've no
Wragbys to offer. In fact, you know what you'll get out of me. No, no,
I think you're right! I really do! And I'm not keen on coming to live on
you, being kept by you. There's that too."
She felt, somehow, as if he were giving her tit for tat.
"But you want me, don't you?" she asked.
"Do you want me?"
"You know I do. That's evident."
"Quite! And when do you want me?"
"You know we can arrange it all when I come back. Now I'm out of
breath with you. I must get calm and clear."
"Quite! Get calm and clear!"
She was a little offended.
"But you trust me, don't you?" she said.
"Oh, absolutely!"
She heard the mockery in his tone.
"Tell me, then," she said flatly; "do you think it would be better if I
don't go to Venice?"
"I'm sure it's better if you do go to Venice," he replied in the cool,
slightly mocking voice.
"You know it's next Thursday?" she said.
"Yes!"
She now began to muse. At last she said:
"And we shall know better where we are when I come back, shan't
we?"
"Oh, surely!"
The curious gulf of silence between them!
"I've been to the lawyer about my divorce," he said, a little
constrainedly.
She gave a slight shudder.
"Have you!" she said. "And what did he say?"
"He said I ought to have done it before; that may be a difficulty. But
since I was in the army, he thinks it will go through all right. If only it
doesn't bring her down on my head!"
"Will she have to know?"
"Yes! she is served with a notice: so is the man she lives with, the
co-respondent."
"Isn't it hateful, all the performances! I suppose I'd have to go
through it with Clifford."
There was a silence.
"And of course," he said, "I have to live an exemplary life for the next
six or eight months. So if you go to Venice, there's temptation
removed for a week or two, at least."
"Am I temptation!" she said, stroking his face. "I'm so glad I'm
temptation to you! Don't let's think about it! You frighten me when
you start thinking: you roll me out flat. Don't let's think about it. We
can think so much when we are apart. That's the whole point! I've
been thinking, I must come to you for another night before I go. I
must come once more to the cottage. Shall I come on Thursday
night?"
"Isn't that when your sister will be there?"
"Yes! But she said we would start at teatime. So we could start at
teatime. But she could sleep somewhere else and I could sleep with
you."
"But then she'd have to know."
"Oh, I shall tell her. I've more or less told her already. I must talk it all
over with Hilda. She's a great help, so sensible."
He was thinking of her plan.
"So you'd start off from Wragby at teatime, as if you were going to
London? Which way were you going?"
"By Nottingham and Grantham."
"And then your sister would drop you somewhere and you'd walk or
drive back here? Sounds very risky, to me."
"Does it? Well then, Hilda could bring me back. She could sleep at
Mansfield, and bring me back here in the evening, and fetch me
again in the morning. It's quite easy."
"And the people who see you?"
"I'll wear goggles and a veil."
He pondered for some time.
"Well," he said. "You please yourself, as usual."
"But wouldn't it please you?"
"Oh, yes! It'd please me all right," he said a little grimly. "I might as
well smite while the iron's hot."
"Do you know what I thought?" she said suddenly. "It suddenly came
to me. You are the 'Knight of the Burning Pestle'!"
"Ay! And you? Are you the Lady of the Red-Hot Mortar?"
"Yes!" she said. "Yes! You're Sir Pestle and I'm Lady Mortar."
"All right, then I'm knighted. John Thomas is Sir John, to your Lady
Jane."
"Yes! John Thomas is knighted! I'm my-lady-maiden-hair, and you
must have flowers too. Yes!"
She threaded two pink campions in the bush of red-gold hair above
his penis.
"There!" she said. "Charming! Charming! Sir John!"
And she pushed a bit of forget-me-not in the dark hair of his breast.
"And you won't forget me there, will you?" she kissed him on the
breast, and made two bits of forget-me-not lodge one over each
nipple, kissing him again.
"Make a calendar of me!" he said. He laughed, and the flowers
shook from his breast.
"Wait a bit!" he said.
He rose, and opened the door of the hut. Flossie, lying in the porch,
got up and looked at him.
"Ay, it's me!" he said.
The rain had ceased. There was a wet, heavy, perfumed stillness.
Evening was approaching.
He went out and down the little path in the opposite direction from
the riding. Connie watched his thin, white figure, and it looked to her
like a ghost, an apparition moving away from her.
When she could see it no more, her heart sank. She stood in the
door of the hut, with a blanket round her, looking into the drenched,
motionless silence.
But he was coming back, trotting strangely, and carrying flowers.
She was a little afraid of him, as if he were not quite human. And
when he came near, his eyes looked into hers, but she could not
understand the meaning.
He had brought columbines and campions, and new-mown hay, and
oak-tufts and honeysuckle in small bud. He fastened fluffy young
oak-sprays round her breasts, sticking in tufts of bluebells and
campion: and in her navel he poised a pink campion flower, and in
her maiden-hair were forget-me-nots and woodruff.
"That's you in all your glory!" he said. "Lady Jane, at her wedding
with John Thomas."
And he stuck flowers in the hair of his own body, and wound a bit of
creeping-jenny round his penis, and stuck a single bell of a hyacinth
in his navel. She watched him with amusement, his odd intentness.
And she pushed a campion flower in his moustache, where it stuck,
dangling under his nose.
"This is John Thomas marryin' Lady Jane," he said. "An' we mun let
Constance an' Oliver go their ways. Maybe—"
He spread out his hand with a gesture, and then he sneezed,
sneezing away the flowers from his nose and his navel. He sneezed
again.
"Maybe what?" she said, waiting for him to go on.
He looked at her a little bewildered.
"Eh?" he said.
"Maybe what? Go on with what you were going to say," she insisted.
"Ay, what was I going to say?"
He had forgotten. And it was one of the disappointments of her life,
that he never finished.
A yellow ray of sun shone over the trees.
"Sun!" he said. "And time you went. Time, my lady, time! What's that
as flies without wings, your ladyship? Time! Time!"
He reached for his shirt.
"Say good night! to John Thomas," he said, looking down at his
penis. "He's safe in the arms of creeping-jenny! Not much burning
pestle about him just now."
And he put his flannel shirt over his head.
"A man's most dangerous moment," he said, when his head had
emerged, "is when he's getting into his shirt. Then he puts his head
in a bag. That's why I prefer those American shirts, that you put on
like a jacket." She still stood watching him. He stepped into his short
drawers, and buttoned them round the waist.
"Look at Jane!" he said. "In all her blossoms! Who'll put blossoms on
you next year, Jinny? Me, or somebody else? 'Good-bye my
bluebell, farewell to you!' I hate that song, it's early war days." He
had sat down, and was pulling on his stockings. She still stood
unmoving. He laid his hand on the slope of her buttocks. "Pretty little
Lady Jane!" he said. "Perhaps in Venice you'll find a man who'll put
jasmine in your maiden-hair, and a pomegranate flower in your
navel. Poor little Lady Jane!"
"Don't say those things!" she said. "You only say them to hurt me."
He dropped his head. Then he said, in dialect:
"Ay, maybe I do, maybe I do! Well then, I'll say nowt, an' ha' done
wi't. But tha mun dress thysen, an' go back to thy stately homes of
England, how beautiful they stand. Time's up! Time's up for Sir John,
an' for little Lady Jane! Put thy shimmy on, Lady Chatterley! Tha
might be anybody, standin' there be-out even a shimmy, an' a few
rags o' flowers. There then, there then, I'll undress thee, tha bob-
tailed young throstle." And he took the leaves from her hair, kissing
her damp hair, and the flowers from her breasts, and kissed her
breasts, and kissed her navel, and kissed her maiden-hair, where he
left the flowers threaded. "They mun stop while they will," he said.
"So! There tha'rt bare again, nowt but a bare-arsed lass an' a bit of a
Lady Jane! Now put thy shimmy on, for tha mun go, or else Lady
Chatterley's going to be late for dinner, an' where 'ave yer been to
my pretty maid!"
She never knew how to answer him when he was in this condition of
the vernacular. So she dressed herself and prepared to go a little
ignominiously home to Wragby. Or so she felt it: a little ignominiously
home.
He would accompany her to the broad riding. His young pheasants
were all right under the shelter.
When he and she came out on to the riding, there was Mrs. Bolton
faltering palely towards them.
"Oh, my Lady, we wondered if anything had happened!"
"No! Nothing has happened."
Mrs. Bolton looked into the man's face, that was smooth and new-
looking with love. She met his half-laughing, half-mocking eyes. He
always laughed at mischance. But he looked at her kindly.
"Evening, Mrs. Bolton! Your Ladyship will be all right now, so I can
leave you. Good night to your ladyship! Good night, Mrs. Bolton!"
He saluted and turned away.
CHAPTER XVI
Connie arrived home to an ordeal of cross-questioning. Clifford had
been out at teatime, had come in just before the storm, and where
was her ladyship? Nobody knew, only Mrs. Bolton suggested she
had gone for a walk into the wood. Into the wood, in such a storm!
Clifford for once let himself get into a state of nervous frenzy. He
started at every flash of lightning, and blenched at every roll of
thunder. He looked at the icy thunder-rain as if it were the end of the
world. He got more and more worked up.
Mrs. Bolton tried to soothe him.
"She'll be sheltering in the hut, till it's over. Don't worry, her ladyship
is all right."
"I don't like her being in the wood in a storm like this! I don't like her
being in the wood at all! She's been gone now more than two hours.
When did she go out?"
"A little while before you came in."
"I didn't see her in the park. God knows where she is and what has
happened to her."
"Oh, nothing's happened to her. You'll see, she'll be home directly
after the rain stops. It's just the rain that's keeping her."
But her ladyship did not come home directly the rain stopped. In fact
time went by, the sun came out for his last yellow glimpse, and there
still was no sign of her. The sun was set, it was growing dark, and
the first dinner-gong had rung.
"It's no good!" said Clifford in a frenzy. "I'm going to send out Field
and Betts to find her."
"Oh, don't do that!" cried Mrs. Bolton. "They'll think there's suicide or
something. Oh, don't start a lot of talk going—Let me slip over to the
hut and see if she's not there. I'll find her all right."
So, after some persuasion, Clifford allowed her to go.
And so Connie had come upon her in the drive, alone and palely
loitering.
"You mustn't mind me coming to look for you, my Lady! But Sir
Clifford worked himself up into such a state. He made sure you were
struck by lightning, or killed by a falling tree. And he was determined
to send Field and Betts to the wood to find the body. So I thought I'd
better come, rather than set all the servants agog."
She spoke nervously. She could still see on Connie's face the
smoothness and the half-dream of passion, and she could feel the
irritation against herself.
"Quite!" said Connie. And she could say no more.
The two women plodded on through the wet world, in silence, while
great drops splashed like explosions in the wood. When they came
to the park, Connie strode ahead, and Mrs. Bolton panted a little.
She was getting plumper.
"How foolish of Clifford to make a fuss!" said Connie at length,
angrily, really speaking to herself.
"Oh, you know what men are! They like working themselves up. But
he'll be all right as soon as he sees your ladyship."
Connie was very angry that Mrs. Bolton knew her secret: for certainly
she knew it.
Suddenly Constance stood still on the path.
"It's monstrous that I should have to be followed!" she said, her eyes
flashing.
"Oh! your Ladyship, don't say that! He'd certainly have sent the two
men, and they'd have come straight to the hut. I didn't know where it
was, really."
Connie flushed darker with rage, at the suggestion. Yet, while her
passion was on her, she could not lie. She could not even pretend
there was nothing between herself and the keeper. She looked at the
other woman, who stood so sly, with her head dropped: yet
somehow, in her femaleness, an ally.
"Oh well!" she said. "If it is so, it is so. I don't mind!"
"Why, you're all right, my Lady! You've only been sheltering in the
hut. It's absolutely nothing."
They went on to the house. Connie marched in to Clifford's room,
furious with him, furious with his pale, over-wrought face and
prominent eyes.
"I must say, I don't think you need send the servants after me!" she
burst out.
"My God!" he exploded. "Where have you been, woman? You've
been gone hours, hours, and in a storm like this! What the hell do
you go to that bloody wood for? What have you been up to? It's
hours even since the rain stopped, hours! Do you know what time it
is? You're enough to drive anybody mad. Where have you been?
What in the name of hell have you been doing?"
"And what if I don't choose to tell you?" She pulled her hat from her
head and shook her hair.
He looked at her with his eyes bulging, and yellow coming into the
whites. It was very bad for him to get into these rages: Mrs. Bolton
had a weary time with him, for days after. Connie felt a sudden
qualm.
"But really!" she said, milder, "Anyone would think I'd been I don't
know where! I just sat in the hut during all the storm, and made
myself a little fire, and was happy."
She spoke now easily. After all, why work him up any more! He
looked at her suspiciously.
"And look at your hair!" he said; "look at yourself!"
"Yes!" she replied calmly. "I ran out in the rain with no clothes on."
He stared at her speechless.
"You must be mad!" he said.
"Why? To like a shower-bath from the rain?"
"And how did you dry yourself?"
"On an old towel and at the fire."
He still stared at her in a dumbfounded way.
"And supposing anybody came," he said.
"Who would come?"
"Who? Why anybody! And Mellors. Does he come? He must come in
the evenings."
"Yes, he came later, when it had cleared up, to feed the pheasants
with corn."
She spoke with amazing nonchalance. Mrs. Bolton, who was
listening in the next room, heard in sheer admiration. To think a
woman could carry it off so naturally!
"And suppose he'd come while you were running about in the rain
with nothing on, like a maniac?"
"I suppose he'd have had the fright of his life, and cleared out as fast
as he could."
Clifford still stared at her transfixed. What he thought in his under-
consciousness he would never know. And he was too much taken
aback to form one clear thought in his upper-consciousness. He just
simply accepted what she said, in a sort of blank. And he admired
her. He could not help admiring her. She looked so flushed and
handsome and smooth: love smooth.
"At least," he said, subsiding, "you'll be lucky if you've got off without
a severe cold."
"Oh, I haven't got a cold," she replied. She was thinking to herself of
the other man's words: Tha's got the nicest woman's arse of
anybody! She wished, she dearly wished she could tell Clifford that
this had been said her, during the famous thunderstorm. However!
She bore herself rather like an offended queen, and went upstairs to
change.
That evening, Clifford wanted to be nice to her. He was reading one
of the latest scientific-religious books: he had a streak of a spurious
sort of religion in him, and was egocentrically concerned with the
future of his own ego. It was like his habit to make conversation to
Connie about some book, since the conversation between them had
to be made, almost chemically. They had almost chemically to
concoct it in their heads.
"What do you think of this, by the way?" he said, reaching for his
book. "You'd have no need to cool your ardent body by running out in
the rain, if only we had a few more aeons of evolution behind us. Ah
here it is!—'The universe shows us two aspects: on one side it is
physically wasting, on the other it is spiritually ascending.'"
Connie listened, expecting more. But Clifford was waiting. She
looked at him in surprise.
"And if it spiritually ascends," she said, "what does it leave down
below, in the place where its tail used to be?"
"Ah!" he said. "Take the man for what he means. Ascending is the
opposite of his wasting, I presume."
"Spiritually blown out, so to speak!"
"No, but seriously, without joking: do you think there is anything in
it?"
She looked at him again.
"Physically wasting?" she said. "I see you getting fatter, and I'm not
wasting myself. Do you think the sun is smaller than he used to be?
He's not to me. And I suppose the apple Adam offered Eve wasn't
really much bigger, if any, than one of our orange pippins. Do you
think it was?"
"Well, hear how he goes on: 'It is thus slowly passing, with a
slowness inconceivable in our measures of time, to new creative
conditions, amid which the physical world, as we at present know it,
will be represented by a ripple barely to be distinguished from
nonentity.'"
She listened with a glisten of amusement. All sorts of improper
things suggested themselves. But she only said:
"What silly hocus-pocus! As if his little conceited consciousness
could know what was happening as slowly as all that! It only means
he's a physical failure on the earth, so he wants to make the whole
universe a physical failure. Priggish little impertinence!"
"Oh, but listen! Don't interrupt the great man's solemn words! 'The
present type of order in the world has risen from an unimaginable
past, and will find its grave in an unimaginable future. There remains
the inexhaustive realm of abstract forms, and creativity with its
shifting character ever determined afresh by its own creatures, and
God, upon whose wisdom all forms of order depend.' There, that's
how he winds up!"
Connie sat listening contemptuously.
"He's spiritually blown out," she said. "What a lot of stuff!
Unimaginables, and types of order in graves, and realms of abstract
forms, and creativity with a shifty character, and God mixed up with
forms of order! Why it's idiotic!"
"I must say, it is a little vaguely conglomerate, a mixture of gases, so
to speak," said Clifford. "Still, I think there is something in the idea
that the universe is physically wasting and spiritually ascending."
"Do you? Then let it ascend, so long as it leaves me safely and
solidly physically here below."
"Do you like your physique?" he asked.
"I love it!" And through her mind went the words: It's the nicest,
nicest woman's arse as is!
"But that is really rather extraordinary, because there's no denying
it's an encumbrance. But then I suppose a woman doesn't take a
supreme pleasure in the life of the mind."
"Supreme pleasure?" she said, looking up at him. "Is that sort of
idiocy the supreme pleasure of the life of the mind? No thank you!
Give me the body. I believe the life of the body is a greater reality
than the life of the mind: when the body is really wakened to life. But
so many people, like your famous wind-machine, have only got
minds tacked on to their physical corpses."
He looked at her in wonder.
"The life of the body," he said, "is just the life of the animals."
"And that's better than the life of professional corpses. But it's not
true! The human body is only just coming to real life. With the
Greeks it gave a lovely flicker, then Plato and Aristotle killed it, and
Jesus finished it off. But now the body is coming really to life, it is
really rising from the tomb. And it will be a lovely, lovely life in the
lovely universe, the life of the human body."
"My dear, you speak as if you were ushering it all in! True, you are
going away on a holiday: but don't please be quite so indecently
elated about it. Believe me, whatever God there is is slowly
eliminating the guts and alimentary system from the human being, to
evolve a higher, more spiritual being."
"Why should I believe you, Clifford, when I feel that whatever God
there is has at last wakened up in my guts, as you call them, and is
rippling so happily there, like dawn. Why should I believe you, when I
feel so very much the contrary?"
"Oh, exactly! And what has caused this extraordinary change in you?
Running out stark naked in the rain, and playing Bacchante? Desire
for sensation, or the anticipation of going to Venice?"
"Both! Do you think it is horrid of me to be so thrilled at going off?"
she said.
"Rather horrid to show it so plainly."
"Then I'll hide it."
"Oh, don't trouble! You almost communicate a thrill to me. I almost
feel that it is I who am going off."
"Well, why don't you come?"
"We've gone over all that. And as a matter of fact, I suppose your
greatest thrill comes from being able to say a temporary farewell to
all this. Nothing so thrilling, for the moment, as Good-bye-to-it-all!
But every parting means a meeting elsewhere. And every meeting is
a new bondage."
"I'm not going to enter any new bondages."
"Don't boast, while the gods are listening," he said.
She pulled up short.
"No! I won't boast!" she said.
But she was thrilled, none the less, to be going off: to feel bonds
snap. She couldn't help it.
Clifford, who couldn't sleep, gambled all night with Mrs. Bolton, till
she was too sleepy almost to live.
And the day came round for Hilda to arrive. Connie had arranged
with Mellors that if everything promised well for their night together,
she would hang a green shawl out of the window. If there were
frustration, a red one.
Mrs. Bolton helped Connie to pack.
"It will be so good for your ladyship to have a change."
"I think it will. You don't mind having Sir Clifford on your hands alone
for a time, do you?"
"Oh, no! I can manage him quite all right. I mean, I can do all he
needs me to do. Don't you think he's better than he used to be?"
"Oh much! You do wonders with him."
"Do I though! But men are all alike: just babies, and you have to
flatter them and wheedle them and let them think they're having their
own way. Don't you find it so, my Lady!"
"I'm afraid I haven't much experience."
Connie paused in her occupation.
"Even your husband, did you have to manage him, and wheedle him
like a baby?" she asked, looking at the other woman.
Mrs. Bolton paused too.
"Well!" she said. "I had to do a good bit of coaxing, with him too. But
he always knew what I was after, I must say that. But he generally
gave in to me."
"He was never the lord and master thing?"
"No! At least there'd be a look in his eyes sometimes, and then I
knew I'd got to give in. But usually he gave in to me. No, he was
never lord and master. But neither was I. I knew when I could go no
further with him, and then I gave in: though it cost me a good bit,
sometimes."
"And what if you had held out against him?"
"Oh, I don't know. I never did. Even when he was in the wrong, if he
was fixed, I gave in. You see I never wanted to break what was
between us. And if you really set your will against a man, that
finishes it. If you care for a man, you have to give in to him once he's
really determined; whether you're in the right or not, you have to give
in. Else you break something. But I must say, Ted 'ud give in to me
sometimes, when I was set on a thing, and in the wrong. So I
suppose it cuts both ways."
"And that's how you are with all your patients?" asked Connie.
"Oh, that's different. I don't care at all, in the same way. I know
what's good for them, or I try to, and then I just contrive to manage
them for their own good. It's not like anybody as you're really fond of.
It's quite different. Once you've been really fond of a man, you can
be affectionate to almost any man, if he needs you at all. But it's not
the same thing. You don't really care. I doubt, once you've really
cared, if you can ever really care again."
These words frightened Connie.
"Do you think one can only care once?" she asked.
"Or never. Most women never care, never begin to. They don't know
what it means. Nor men either. But when I see a woman as cares,
my heart stands still for her."
"And do you think men easily take offence?"
"Yes! If you wound them on their pride. But aren't women the same?
Only our two prides are a bit different."
Connie pondered this. She began again to have some misgiving
about her going away. After all, was she not giving the man the go-
by, if only for a short time? And he knew it. That's why he was so
queer and sarcastic.
Still! the human existence is a good deal controlled by the machine
of external circumstance. She was in the power of this machine. She
couldn't extricate herself all in five minutes. She didn't even want to.
Hilda arrived in good time on Thursday morning, in a nimble two-
seater car, with her suitcase strapped firmly behind. She looked as
demure and maidenly as ever, but she had the same will of her own.
She had the very hell of a will of her own, as her husband had found
out. But the husband was now divorcing her. Yes, she even made it
easy for him to do that, though she had no lover. For the time being,
she was "off" men. She was very well content to be quite her own
mistress: and mistress of her two children, whom she was going to
bring up "properly," whatever that may mean.
Connie was only allowed a suitcase, also. But she had sent on a
trunk to her father, who was going by train. No use taking a car to
Venice. And Italy much too hot to motor in, in July. He was going
comfortably by train. He had just come down from Scotland.
So, like a demure arcadian field-marshall, Hilda arranged the
material part of the journey. She and Connie sat in the upstairs room,
chatting.
"But, Hilda!" said Connie, a little frightened. "I want to stay near here
tonight. Not here: near here!"
Hilda fixed her sister with grey, inscrutable eyes. She seemed so
calm: and she was so often furious.
"Where, near here?" she asked softly.
"Well, you know I love somebody, don't you?"
"I gathered there was something."
"Well, he lives near here, and I want to spend this last night with him.
I must! I've promised."
Connie became insistent.
Hilda bent her Minerva-like head in silence. Then she looked up.
"Do you want to tell me who he is," she said.
"He's our gamekeeper," faltered Connie, and she flushed vividly, like
a shamed child.
"Connie!" said Hilda, lifting her nose slightly with disgust: a motion
she had from her mother.
"I know: but he's lovely really. He really understands tenderness,"
said Connie, trying to apologise for him.
Hilda, like a ruddy, rich-coloured Athena, bowed her head and
pondered. She was really violently angry. But she dared not show it,
because Connie, taking after her father, would straightway become
obstreperous and unmanageable.
It was true, Hilda did not like Clifford: his cool assurance that he was
somebody! She thought he made use of Connie shamefully and
impudently. She had hoped her sister would leave him. But, being
solid Scotch middle class, she loathed any "lowering" of oneself, or
the family. She looked up at last.
"You'll regret it," she said.
"I shan't," cried Connie, flushed red. "He's quite the exception. I
really love him. He's lovely as a lover."
Hilda still pondered.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com
Ad

More Related Content

Similar to WebWork in Action In Action First Edition Patrick Lightbody (20)

ASP.NET Core in Action (2018).pdf
ASP.NET Core in Action (2018).pdfASP.NET Core in Action (2018).pdf
ASP.NET Core in Action (2018).pdf
Emma Burke
 
Go Web Programming 1st Edition Sau Sheong Chang
Go Web Programming 1st Edition Sau Sheong ChangGo Web Programming 1st Edition Sau Sheong Chang
Go Web Programming 1st Edition Sau Sheong Chang
braykoofunne
 
Continuous Integration in NET Marcin Kawalerowicz
Continuous Integration in NET Marcin KawalerowiczContinuous Integration in NET Marcin Kawalerowicz
Continuous Integration in NET Marcin Kawalerowicz
senawoalklb
 
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn downloadPDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
xalanaunnuk
 
AOP in NET Practical Aspect Oriented Programming Matthew D. Groves
AOP in NET Practical Aspect Oriented Programming Matthew D. GrovesAOP in NET Practical Aspect Oriented Programming Matthew D. Groves
AOP in NET Practical Aspect Oriented Programming Matthew D. Groves
anusansuphi
 
ASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele BochicchioASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele Bochicchio
fofangomeal55
 
(Ebook) JavaScript Application Design: A Build First Approach by Nicolas Be...
(Ebook) JavaScript Application Design: A Build First Approach   by Nicolas Be...(Ebook) JavaScript Application Design: A Build First Approach   by Nicolas Be...
(Ebook) JavaScript Application Design: A Build First Approach by Nicolas Be...
hakwonjoxido51
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
taajderner
 
Exam Ref 70 486 Developing ASP NET MVC 4 Web Applications William Penberthy
Exam Ref 70 486 Developing ASP NET MVC 4 Web Applications William PenberthyExam Ref 70 486 Developing ASP NET MVC 4 Web Applications William Penberthy
Exam Ref 70 486 Developing ASP NET MVC 4 Web Applications William Penberthy
zeemetapa
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
gydalravid
 
[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters
[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters
[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters
jnasjsgaiel
 
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
abucdaroga
 
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
barbuhalahdl
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
krulatasev
 
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
eljantnezar
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
zarievidaja
 
ASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele BochicchioASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele Bochicchio
sabenaforu
 
iOS 7 in Action 1st Edition Brendan G. Lim
iOS 7 in Action 1st Edition Brendan G. LimiOS 7 in Action 1st Edition Brendan G. Lim
iOS 7 in Action 1st Edition Brendan G. Lim
bambildurdle
 
Objective C Fundamentals 1st Edition Christopher Fairbairn
Objective C Fundamentals 1st Edition Christopher FairbairnObjective C Fundamentals 1st Edition Christopher Fairbairn
Objective C Fundamentals 1st Edition Christopher Fairbairn
mitclxlt
 
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
quizaloan
 
ASP.NET Core in Action (2018).pdf
ASP.NET Core in Action (2018).pdfASP.NET Core in Action (2018).pdf
ASP.NET Core in Action (2018).pdf
Emma Burke
 
Go Web Programming 1st Edition Sau Sheong Chang
Go Web Programming 1st Edition Sau Sheong ChangGo Web Programming 1st Edition Sau Sheong Chang
Go Web Programming 1st Edition Sau Sheong Chang
braykoofunne
 
Continuous Integration in NET Marcin Kawalerowicz
Continuous Integration in NET Marcin KawalerowiczContinuous Integration in NET Marcin Kawalerowicz
Continuous Integration in NET Marcin Kawalerowicz
senawoalklb
 
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn downloadPDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
xalanaunnuk
 
AOP in NET Practical Aspect Oriented Programming Matthew D. Groves
AOP in NET Practical Aspect Oriented Programming Matthew D. GrovesAOP in NET Practical Aspect Oriented Programming Matthew D. Groves
AOP in NET Practical Aspect Oriented Programming Matthew D. Groves
anusansuphi
 
ASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele BochicchioASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele Bochicchio
fofangomeal55
 
(Ebook) JavaScript Application Design: A Build First Approach by Nicolas Be...
(Ebook) JavaScript Application Design: A Build First Approach   by Nicolas Be...(Ebook) JavaScript Application Design: A Build First Approach   by Nicolas Be...
(Ebook) JavaScript Application Design: A Build First Approach by Nicolas Be...
hakwonjoxido51
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
taajderner
 
Exam Ref 70 486 Developing ASP NET MVC 4 Web Applications William Penberthy
Exam Ref 70 486 Developing ASP NET MVC 4 Web Applications William PenberthyExam Ref 70 486 Developing ASP NET MVC 4 Web Applications William Penberthy
Exam Ref 70 486 Developing ASP NET MVC 4 Web Applications William Penberthy
zeemetapa
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
gydalravid
 
[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters
[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters
[Ebooks PDF] download Ajax in Practice 1st Edition Dave Crane full chapters
jnasjsgaiel
 
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
abucdaroga
 
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
barbuhalahdl
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
krulatasev
 
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
Using Docker Developing and Deploying Software with Containers 1st Edition Ad...
eljantnezar
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs RademakersOpen Source ESBs in Action 1st Edition Tijs Rademakers
Open Source ESBs in Action 1st Edition Tijs Rademakers
zarievidaja
 
ASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele BochicchioASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele Bochicchio
sabenaforu
 
iOS 7 in Action 1st Edition Brendan G. Lim
iOS 7 in Action 1st Edition Brendan G. LimiOS 7 in Action 1st Edition Brendan G. Lim
iOS 7 in Action 1st Edition Brendan G. Lim
bambildurdle
 
Objective C Fundamentals 1st Edition Christopher Fairbairn
Objective C Fundamentals 1st Edition Christopher FairbairnObjective C Fundamentals 1st Edition Christopher Fairbairn
Objective C Fundamentals 1st Edition Christopher Fairbairn
mitclxlt
 
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
quizaloan
 

Recently uploaded (20)

How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Ad

WebWork in Action In Action First Edition Patrick Lightbody

  • 1. Visit https://ebookfinal.com to download the full version and explore more ebooks WebWork in Action In Action First Edition Patrick Lightbody _____ Click the link below to download _____ https://ebookfinal.com/download/webwork-in-action-in- action-first-edition-patrick-lightbody/ Explore and download more ebooks at ebookfinal.com
  • 2. Here are some suggested products you might be interested in. Click the link to download IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders https://ebookfinal.com/download/intellij-idea-in-action-in-action- series-1st-edition-stephen-saunders/ Scala in Action Nilanjan Raychaudhuri https://ebookfinal.com/download/scala-in-action-nilanjan-raychaudhuri/ DSLs in Action Debasish Ghosh https://ebookfinal.com/download/dsls-in-action-debasish-ghosh/ Camel in Action Claus Ibsen https://ebookfinal.com/download/camel-in-action-claus-ibsen/
  • 3. Earth First Direct Action Manual 3rd Edition Earth First! https://ebookfinal.com/download/earth-first-direct-action-manual-3rd- edition-earth-first/ Grails in Action 1st Edition Glen Smith https://ebookfinal.com/download/grails-in-action-1st-edition-glen- smith/ Lucene in Action 2nd Edition Michael Mccandless https://ebookfinal.com/download/lucene-in-action-2nd-edition-michael- mccandless/ Psychology in Action Ninth Edition Karen Huffman https://ebookfinal.com/download/psychology-in-action-ninth-edition- karen-huffman/ Kafka in Action 1st Edition Dylan Scott https://ebookfinal.com/download/kafka-in-action-1st-edition-dylan- scott/
  • 5. WebWork in Action In Action First Edition Patrick Lightbody Digital Instant Download Author(s): Patrick Lightbody, Jason Carreira ISBN(s): 9781932394641, 1932394648 Edition: First Edition File Details: PDF, 5.39 MB Year: 2005 Language: english
  • 9. WebWork in Action PATRICK LIGHTBODY JASON CARREIRA M A N N I N G Greenwich (74° w. long.) Licensed to Shirong Chen <[email protected]>
  • 10. For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. 209 Bruce Park Avenue Fax:(203) 661-9018 Greenwich, CT 06830 email: [email protected] ©2006 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books they publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Tiffany Taylor 209 Bruce Park Avenue Typesetter: Gordan Salinovic Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1-394932-53-2 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – VHG – 10 09 08 07 06 05 Licensed to Shirong Chen <[email protected]>
  • 11. v brief contents PART 1 INTRODUCTION TO WEBWORK ................... 1 Chapter 1 ■ An overview of WebWork 3 Chapter 2 ■ HelloWorld, the WebWork way 19 Chapter 3 ■ Setting up WebWork 38 PART 2 CORE CONCEPTS....................................... 75 Chapter 4 ■ Implementing WebWork actions 77 Chapter 5 ■ Adding functionality with interceptors 112 Chapter 6 ■ Inversion of Control 137 PART 3 DISPLAYING CONTENT ............................ 175 Chapter 7 ■ Using results 177 Chapter 8 ■ Getting data with the expression language 209 Chapter 9 ■ Tag libraries 230 Chapter 10 ■ Velocity 254 Chapter 11 ■ UI components 271 Licensed to Shirong Chen <[email protected]>
  • 12. vi BRIEF CONTENTS PART 4 ADVANCED TOPICS.................................. 311 Chapter 12 ■ Type conversion 313 Chapter 13 ■ Validating form data 333 Chapter 14 ■ Internationalization 360 Chapter 15 ■ Best practices 384 Appendix ■ WebWork architecture 424 Licensed to Shirong Chen <[email protected]>
  • 13. vii contents foreword xv preface xvii acknowledgments xix about this book xxi a look at the future xxvi about the title xxvii about the cover illustration xxviii PART 1 INTRODUCTION TO WEBWORK .........................1 1 An overview of WebWork 3 1.1 Why MVC is important 5 Classic MVC becomes outdated 6 ■ Classic MVC gets an update: the Front Controller 7 ■ MVC evolves: the Page Controller 7 1.2 Understanding frameworks and containers 9 What is a framework? 9 ■ What a container can do 11 1.3 WebWork: past, present, and future 13 The history of WebWork 13 ■ Understanding the XWork core 13 Future directions 15 Licensed to Shirong Chen <[email protected]>
  • 14. viii CONTENTS 1.4 The CaveatEmptor application 15 How CaveatEmptor is organized 16 1.5 Summary 17 2 HelloWorld, the WebWork way 19 2.1 Downloading WebWork 20 2.2 Preparing the skeleton 20 Creating the web.xml deployment file 21 ■ Creating the xwork.xml configuration file 23 ■ Creating the webwork.properties configuration file 23 ■ Tips for developing WebWork apps 24 2.3 Your first action 24 Saying hello, the WebWork way 25 ■ Displaying output to the web browser 26 ■ Configuring your new action 27 2.4 Dealing with inputs 28 2.5 Advanced control flow 31 2.6 Letting WebWork do the work 33 Taking advantage of ActionSupport 34 ■ Intermediate modifications to the JSP 35 ■ Exploring the UI tag library 36 2.7 Summary 37 3 Setting up WebWork 38 3.1 Configuring actions, results, and interceptors 39 Overview of terminology 39 ■ Actions 40 Results 46 ■ Interceptors 48 3.2 Advanced configuration 52 The xwork.xml DTD 52 ■ Namespaces and packages 53 Componentization using the include tag 57 3.3 Other configuration files 66 Web-app configuration: web.xml 66 Feature configuration: webwork.properties 67 3.4 Setting up your web app 70 General layout 70 ■ Required libraries 71 ■ Optional libraries 72 3.5 Summary 72 Licensed to Shirong Chen <[email protected]>
  • 15. CONTENTS ix PART 2 CORE CONCEPTS ............................................ 75 4 Implementing WebWork actions 77 4.1 The Action interface 78 Result codes 78 ■ Handling exceptions 79 4.2 Using the ActionSupport base class 80 4.3 Understanding basic validation 80 Validating an action: Validateable 81 Displaying error messages: ValidationAware 82 4.4 Using localized message texts 86 Retrieving the user’s locale: LocaleProvider 86 Displaying the localized text: TextProvider 86 Providing messages for other languages 89 4.5 Advanced inputs 90 Intermediary objects 90 ■ Using domain objects directly 91 4.6 Working with ModelDriven actions 95 Implementing ModelDriven actions 96 Considerations when using ModelDriven 100 4.7 Accessing data through the ActionContext 102 CaveatEmptor: accessing the session 102 Example: accessing the request and response 105 4.8 Handling file uploads 107 Accessing uploaded files through the request wrapper 107 Automating file uploads 109 ■ Configuration settings 110 4.9 Summary 111 5 Adding functionality with interceptors 112 5.1 How interceptors are called 113 5.2 Using the prepackaged interceptors 114 Utility interceptors 117 ■ Setting parameters 119 Defining workflow 123 5.3 Using prepackaged interceptor stacks 126 Licensed to Shirong Chen <[email protected]>
  • 16. x CONTENTS 5.4 Building your own interceptors 128 Using the AroundInterceptor as a base 129 ■ Looking at an example custom interceptor 130 ■ Getting callbacks before the result is executed with the PreResultListener 133 ■ Looking out for interceptor interactions 134 5.5 Interceptors vs. servlet filters 135 5.6 Summary 136 6 Inversion of Control 137 6.1 Examining the pattern 138 Common patterns for active resource management 138 ■ Inverting resource management 142 ■ How IoC helps with testing 145 6.2 IoC essentials 146 WebWork’s IoC history 146 ■ Dependencies 148 Scope and lifecycle 149 6.3 Using WebWork’s IoC framework 151 Configuration 151 ■ Creating a new component 154 ■ Using IoC on any object 158 ■ Dealing with complex dependencies 159 6.4 An example from CaveatEmptor 162 The HibernateSessionFactory component 163 ■ The Persistence Manager component 165 ■ Configuring the components 168 Using the new components 169 6.5 Alternatives 170 Alternative IoC containers 170 ■ Non-IoC alternatives 172 6.6 Summary 173 PART 3 DISPLAYING CONTENT ..................................175 7 Using results 177 7.1 Life after the action 178 A simple result 178 ■ Configuring a result 180 7.2 Common results 182 Dispatching to a page 182 ■ Redirecting to a page 188 Chaining to another action 192 Licensed to Shirong Chen <[email protected]>
  • 17. CONTENTS xi 7.3 Other results 197 Streaming Velocity templates directly to the output 197 FreeMarker: an alternative to Velocity 202 Generating reports with JasperReports 203 7.4 Summary 207 8 Getting data with the expression language 209 8.1 What is an expression language? 210 Why an expression language? 210 ■ Why OGNL? 211 Other expression languages 212 ■ Key OGNL concepts 213 8.2 Basic expression language features 213 Accessing bean properties 214 ■ Literals and operators 215 Calling methods 217 ■ Setting values and expression lists 218 Accessing static methods and fields 218 ■ Accessing the OGNL context and the ActionContext 218 8.3 Working with collections 220 Working with lists and arrays 220 ■ Working with maps 221 Filtering and projecting collections 222 ■ The multiple uses of “#” 223 8.4 Advanced expression language features 224 Linking the value stack to the expression language 224 Data type conversion 226 ■ Handling null property access 227 Creating lambda expressions on the fly 228 8.5 Summary 228 9 Tag libraries 230 9.1 Getting started 231 9.2 An overview of WebWork tags 232 The WebWork tag syntax 233 9.3 Data tags 235 The property tag 235 ■ The set tag 236 ■ The push tag 237 The bean tag 238 ■ The action tag 240 9.4 Control tags 242 The iterator tag 242 ■ The if and else tags 245 Licensed to Shirong Chen <[email protected]>
  • 18. xii CONTENTS 9.5 Miscellaneous tags 246 The include tag 246 ■ The URL tag 247 ■ The i18n and text tags 250 ■ The param tag 252 9.6 Summary 253 10 Velocity 254 10.1 Introduction to Velocity 255 What is Velocity? 255 ■ Getting ready to use Velocity 257 10.2 Basic syntax and operations 259 Property access 259 ■ Method calls 261 ■ Control statements: if/else and loops 261 ■ Assigning variables 265 10.3 Advanced techniques 265 The VelocityContext 265 ■ WebWork-supplied objects in the context 266 ■ Customizing the Velocity context 267 10.4 Using JSP tags in Velocity 268 10.5 Loading Velocity templates 269 10.6 Summary 269 11 UI components 271 11.1 Why bother with UI tags? 272 Eliminating the pain 272 ■ More than just form elements 280 11.2 UI tag overview 283 Templates 283 ■ Themes 285 ■ Tag attributes 291 11.3 UI tag reference 291 Common attributes 291 ■ Simple tags 294 Collection-based tags 299 ■ Advanced tags 305 11.4 Summary 309 PART 4 ADVANCED TOPICS ........................................311 12 Type conversion 313 12.1 Why type conversion? 314 The Servlet specification 314 ■ An action without type conversion 315 ■ A view without type conversion 317 What WebWork’s type conversion gives you 319 Licensed to Shirong Chen <[email protected]>
  • 19. CONTENTS xiii 12.2 Configuration 320 Role of a type converter 321 ■ Global type converters 322 Class-level type converters 322 12.3 Simple type conversion 323 Basic type conversion 323 ■ Built-in type conversion 325 Handling null property access 326 12.4 Advanced topics 326 Handling null Collection access 326 ■ Handling conversion errors 329 ■ An example that puts it all together 330 12.5 Summary 331 13 Validating form data 333 13.1 Manually validating data 336 Validating in the execute() method 336 Implementing the Validateable interface 337 13.2 Using the Validation Framework 340 Building your first *-validation.xml file 340 ■ Registering validators 341 ■ Applying the validation interceptor 345 ■ Pulling it all together 346 ■ Looking at some validation XML examples 348 13.3 Exploring the advanced features of the Validation Framework 350 Implementing a custom validator 351 ■ Validating with different contexts 353 ■ Short-circuiting validation 354 The ExpressionValidator 355 ■ Reusing validations with the visitor field validator 356 13.4 Summary 359 14 Internationalization 360 14.1 Exploring a quick internationalization example 361 14.2 Sources for messages 362 Understanding the ResourceBundle search order 364 ■ Adding default resource bundles 366 ■ The <ww:i18n> tag 366 14.3 Using internationalized messages 368 Parameterizing localized texts 368 ■ Using getText() in taglib attributes 369 ■ Formatting dates and numbers 370 ■ Using localized messages in validations 370 ■ Using internationalized texts for type conversion messages 371 Licensed to Shirong Chen <[email protected]>
  • 20. xiv CONTENTS 14.4 Tips and tricks 373 Programmatically setting the locale 373 ■ Implementing Resource- Bundles as classes 375 ■ Using the <ww:param> tag to pass dynamically generated text to message texts 378 ■ Setting the encoding: here, there, and everywhere 381 ■ A note on Java PropertyResourceBundles 382 ■ A final note 382 14.5 Summary 383 15 Best practices 384 15.1 Setting up your environment 385 Setting up your IDE 386 ■ Reloading resources 388 15.2 Unit-testing your actions 389 Using mock objects 389 ■ The advantage of IoC for testing 391 Handling statics and ThreadLocals 391 15.3 Putting the pieces together: integration testing 393 Testing your configuration 393 Seeing the configuration with the config browser 396 15.4 Testing validations 398 Testing programmatic validations 398 Testing validation.xml files 398 15.5 Advanced UI tag usage 402 Overriding existing templates 403 ■ Writing custom templates 406 Writing custom themes 407 15.6 Using form tokens to prevent duplicate form submissions 409 Using the <ww:token> tag 410 ■ Applying the TokenInterceptor 412 ■ Transparently re-rendering pages with the TokenSessionStoreInterceptor 413 15.7 Displaying wait pages automatically 413 15.8 A Single action for CRUD operations 417 Creating new categories with newCategory 418 ■ Reading and updating with viewCategory and editCategory 419 ■ Saving catego- ries with saveCategory 420 ■ Setting the parentCategory 422 15.9 Summary 423 appendix WebWork architecture 424 index 439 Licensed to Shirong Chen <[email protected]>
  • 21. xv foreword Building a framework is difficult. On the one hand, the framework needs to be flexible enough to cater to a wide variety of needs; on the other hand, it needs to be solid enough that it doesn’t fall prey to the beast of complexity—the urge to make it the solution to conquer all other solutions. In today’s development envi- ronment, a multitude of frameworks is available to help you deal with various aspects of creating complex and useful enterprise software. Each framework pro- vides something unique that makes it cover its particular field of application in a (more or less) human-friendly manner; in addition, each framework must work within its boundaries, relating to other frameworks in a software ecology that is constantly changing as needs and requirements change. In order to accomplish this seemingly impossible task, it is necessary to acknowl- edge and study past efforts that a framework is supposed to replace and/or extend. In the case of WebWork, there were, and still are, a number of different approaches and frameworks that I looked at before I set to work. The idea was to create a new framework that allowed developers to get their job done with as little work as pos- sible and perform each task efficiently without needing an unnecessarily complex framework to work against. Simple things should be simple to do while allowing complex things to be possible. Another important aspect of WebWork is that it should allow developers as much freedom as possible to use other technologies—for example, to render out- put. A number of rendering alternatives are available, and it’s impossible—and Licensed to Shirong Chen <[email protected]>
  • 22. xvi FOREWORD futile—to determine which one is best in all situations; such an alternative simply doesn’t, and can’t, exist. Being open minded in this regard is crucial, and it has paid off: WebWork has now been successfully integrated with a wide variety of ren- dering technologies, including some that don’t target HTML or the Web. It has grown beyond its initial purpose, which is always gratifying for a parent. WebWork started as an itch that I needed to personally scratch. However, with its second generation it has expanded into a fully grown community project, where developers add and improve WebWork by leveraging the structure pro- vided by the framework. No framework of this kind, in today’s competitive envi- ronment, can be successful without the input and ideas of a multitude of developers, because it’s important that it be able to handle the real issues that people face in their daily work. As a result, WebWork now has a life of its own and is growing steadily as a community effort. A book covering such a framework needs to be able to deal with all the intrica- cies of framework construction and convey the reasoning behind why it works the way it does; it must also demonstrate in action how all the theoretical stuff works in practice. Theory has no point if it ain’t practically applicable. This book explains in reasonable detail the rationale for how WebWork is constructed, but it’s mainly focused on showing you in practical terms how to use WebWork, from the simple to the complex. Time is always of the essence, and this book is a great investment if you’re interested in learning about web framework construction, or if you want to make a killer web app that blows everyone’s mind. Anything is possible! RICKARD ÖBERG Licensed to Shirong Chen <[email protected]>
  • 23. xvii preface It’s been almost 10 years since I developed my first web-based application. The program was a simple online shopping cart written in Perl. I still have the code lying around, and I look at it occasionally—I do this to remind myself of where I was and to keep myself focused on where I want to go. The application was horri- ble. It consisted of one extremely large Perl file (over 10,000 lines!), and it printed out HTML using lots of print statements. Looking at it today, it’s impossi- ble for me to understand. And yet, 10 years ago, I managed to put together something that not only was functional but also made sense to me. This growth is typical of what most profes- sional developers go through, Jason and me included. The “hacks” I wrote made sense at the time, but as the months and years went on, the code became a rat’s nest and maintenance was a nightmare. This problem is bad enough when you’re developing non-GUI programs, but it’s worse when bad code that handles business logic is mixed with bad code that handles the GUI. And it’s even worse when your GUI is written in HTML, and you’re relying on linearly spitting out HTML tags instead of using object orientation or componentization. Why is this important? Because, like all other developers, Jason and I have grown from novice programmers hacking in Perl and PHP (and not really know- ing what we were doing) to experienced developers with a deep understanding of what it takes to build a maintainable web-based application. Licensed to Shirong Chen <[email protected]>
  • 24. xviii PREFACE Jason and I didn’t create WebWork. It was developed by Rickard Öberg, one of the original authors of JBoss, after he decided there had to be a better way to develop web applications. What came from Rickard was a framework built around the philosophy that the correct way to do something should also be the easiest option, that the path of least resistance is a good thing, and that there is a fine bal- ance between too much flexibility and too little. Jason and I found WebWork through different means, but the end result was the same: We were captivated by its functionality and grace. Over time, we evolved from users to contributors to developers, and now to published authors. In the process, we’ve learned better ways to do things. And similarly, WebWork has also evolved. Jason and I spent endless nights creating version 2.0, which has become a major upgrade and has set the groundwork for doing much more with the Web- Work platform. Today, WebWork is much more than it was in the past. And tomorrow, it will be even better. In this book, you’ll learn the techniques, best practices, and concepts that go with the WebWork framework. You’ll see why we spent so much energy on type conversion and how it relates to HTTP. You’ll learn about how common chal- lenges in the world of HTML (such as the double-submit problem) were solved using interceptors—a feature unique to WebWork. You’ll understand why build- ing reusable templates that generate HTML is the best way to quickly create main- tainable web applications. Mostly, though, you’ll learn a better way to build web applications. Whether you’re already a WebWork user, or you use an alternative Java framework, or you don’t use Java at all, this book provides the concepts and techniques that are the foundation of WebWork. We hope this book serves as a WebWork reference and also as a great tool for sharpening your development skills. PATRICK LIGHTBODY Licensed to Shirong Chen <[email protected]>
  • 25. xix acknowledgments This book wouldn’t have been possible if it weren’t for the tremendous community at OpenSymphony and all the software developers who continue to push for inno- vation in the Java web space. To everyone who uses WebWork or other OpenSym- phony projects: Thank you for the appreciation and support through the years; with this book we’ll continue to drive innovation even further. Of course, this book also couldn’t have been possible without a publisher. To everyone at Manning, thank you for believing in us and in WebWork. This experi- ence has been the most fulfilling project we’ve ever completed. We’d like to rec- ognize the tireless efforts of our editor, Jackie Carter. As we closed in on the final weeks and months, we couldn’t have pulled it off without the amazing proofread- ing, editing, marketing, and coordination provided by Liz Welch, Tiffany Taylor, Karen Tegtmeyer, and Mary Piergies. And finally, thank you to Marjan Bace for having the faith that, even through delays and setbacks, Manning could offer a book that would benefit so many software developers. We also want to make a special mention of Carlos Whitt, who, with little notice, was kind enough to step in and take on the role of technical editor at the last minute. Thanks to Carlos’s diving catch, we received valuable feedback and insightful comments. Carlos, your input was more valuable than we can possibly describe. Thank you. In addition to Carlos’s heroic effort, we want to thank each and every reviewer who provided feedback during the entire process: Jack Her- rington, Drew McAuliffe, Bill Lynch, Dick Zetterberg, Steve Poll, Ryan Daigle, Licensed to Shirong Chen <[email protected]>
  • 26. xx ACKNOWLEDGMENTS Peter White, Luigi Viggiano, Matthew Payne, Joseph B. Ottinger, Hani Suilman, Mark Woon, Berndt Hamboeck, Andrew Oswald, and Dag Liodden. Your feed- back led to some major changes in how this book was structured, and we’re for- ever in your debt for your wisdom. Finally, special thanks and words of appreciation to Rickard Öberg for agreeing to write the foreword to our book. Patrick would also like to thank all his coworkers at Cisco Systems, Spoke Soft- ware, and Jive Software. Without their support, both verbal and technical, he could never have invested the time and energy in a project like WebWork and would certainly have never written a book on the subject. He also thanks his friends and family, who, no matter how much of a hermit he became, stood by his side through the entire process. And finally, many thanks to his girlfriend and best friend, Megan. Without her honesty, encouragement, and love, this book would never have been realized. Jason would first and foremost like to thank his wife, Cyndy, without whose love, support, and nagging, his work on WebWork and this book would not have been possible. He would also like to thank his children, who had to spend too much time watching their dad work on his laptop instead of playing with them. He’d like to thank his former coworkers at Notiva and current coworkers at ePlus, whose wise decision to use WebWork allowed him to put theory to practice in cre- ating great web applications. Finally, he’d like to thank Patrick for picking up his slack at the end when the real world intruded too heavily. Licensed to Shirong Chen <[email protected]>
  • 27. xxi about this book This book is very much what the title says: a book about working on web-based appli- cations, using real-world examples along the way. That’s what WebWork empha- sizes: working on your project, not wrestling with your framework. Although it isn’t the most-used web framework in the Java world, WebWork is widely known as the most refined, and it’s gaining momentum every day. We’ll show you how you can stop wrestling and get your framework to begin working for you. In this book, we’ll walk you through the basics of writing web applications, starting with simple forms and form processing. However, we know you’ve proba- bly done that stuff a million times, and you’re looking to sink your teeth into meatier problems. As such, we quicken the pace and look at advanced features such as validation, data-type conversion, resource dependencies, loose coupling of web application components, and a treasure chest of ways to deal with common challenges unique to the Web. This book stays focused on a single application: CaveatEmptor. This is a modi- fied version of the same application used in Hibernate in Action (Christian Bauer and Gavin King, Manning, 2004). By focusing on a tangible, growing application that you can download and modify, you get the benefit of taking part of an evolu- tionary process that goes beyond the pages of this book. You can expect that for the years following the publication of this book, the CaveatEmptor application will continue to lead the way for showcasing best practices for common web- and persistence-related problems. Licensed to Shirong Chen <[email protected]>
  • 28. xxii ABOUT THIS BOOK Roadmap Chapter 1 provides a basic overview required to help you get started with Web- Work. In addition to answering the hows, whys, and whats, we compare WebWork to other frameworks and outline the philosophy set by Rickard Öberg when he first created WebWork. In chapter 2, we run through several iterations of a basic “Hello, World” appli- cation, starting from an extremely simple read-only example and going all the way to a more advanced input workflow complete with data validation and error reporting. In chapter 3, we begin to look at the configuration options WebWork provides. This chapter covers how to configure individual actions, interceptors, and results, as well as general framework-related options such as what URL pattern to bind to. Chapter 4 improves on the configuration lessons and hands-on experience from the previous two chapters and provides concrete examples of how to create your own WebWork actions. In this chapter we dive deeper into the basic form val- idation, error handling, and localization provided by the ActionSupport base class. We also look at handling alternative data elements in your actions, such as file uploads. By this point, you’ll be comfortable writing applications in WebWork. In the remaining chapters, our goal is to help you use the advanced WebWork features that were created to address everyday problems. In chapter 5, we explore inter- ceptors and how they can add behavior to your actions without your needing to change the action classes or subclass. Chapter 6 explores the Inversion of Control (IoC) pattern and how WebWork provides native support for it while also integrating into other popular IoC frame- works, such as Spring. At this point, we shift gears and begin to focus on issues relating to user inter- faces. We begin by looking at the concept of results in chapter 7. Results include common technologies like JSP but also uncommon ones: template languages such as Velocity and FreeMarker, and reporting engines such as JasperReports. Displaying results isn’t very useful if you can’t include your data. In chapter 8, we take an in-depth look at Object Graph Navigation Language (OGNL): Web- Work’s de facto expression language (EL). We also look at how EL shortcuts can save you a ton of time when you’re rendering web-based forms. Chapter 9 covers all the utility JSP tags that come with WebWork, from the familiar (if/elseif/else) to the unfamiliar (push, pop, action, and set). Even if you choose to develop in a template language such as FreeMarker rather than in Licensed to Shirong Chen <[email protected]>
  • 29. ABOUT THIS BOOK xxiii JSP, this chapter is still important, because similar concepts exist in those other technologies. Now we’ll be almost ready to look at the other half of the JSP tags: the UI tags. However, because they’re implemented in Velocity, we spend chapter 10 present- ing the basics so that you’re well prepared. Chapter 10 is also a good way for you to get up to speed on JSP alternatives. In chapter 11, we look at one of the most important features in WebWork: the UI tags. These tags let you componentize your HTML elements in to easy-to-reuse pieces. Building maintainable and scalable web applications hinges on use of these tags. Chapter 12 examines common issues of type conversion—a challenge all web developers face, regardless of what programming language you’re using. That’s because HTTP is untyped, meaning all inputs are effectively Strings. Chapter 13 looks at advanced validation techniques, focusing on ways to get data validation logic away from your code data manipulation logic. Chapter 14 discusses techniques and features related to internationalization (i18), also known as localization. Finally, in chapter 15, we pull it all together and look at common problems in the web environment and how everything you’ve learned can solve them. We take on the double-submit problem many web developers have faced. We also look at innovative ways to handle long-running processes rather than just asking the user to please wait. In addition to these common problems, we explore test- ing and debugging techniques that are useful when you’re building WebWork- powered applications. Who should read this book? This book is for anyone who’s fed up with web development, or at least wondering if there’s a better way. Specifically, we expect that readers have a basic understand- ing of Java and the commonly used Java APIs, such as the Java Collections API. Because WebWork is all about the Web, a minimum level of understanding of HTML, JavaScript, and CSS is required. Those who don’t work on the web portion of their applications but have coworkers who do are also encouraged to read this book. With advanced features like type conversion, WebWork shows that you may not have to compromise on the design of your application’s API just to appease the framework the web devel- opers use. Licensed to Shirong Chen <[email protected]>
  • 30. xxiv ABOUT THIS BOOK Our hope is that both novice and experienced software developers—even those who aren’t from a primarily Java-based background—can pick up this book and be productive right away. Code conventions and downloads This book provides many examples in various formats found in web applications powered by WebWork: Java code, HTML, XML snippets, JSPs, and template files written in Velocity. All source code in listings or in text is in a fixed-width font like this to separate it from ordinary text. Additionally, Java method names, Java- Bean properties, XML elements, and attributes in text are presented using this same font. Java, HTML, and XML can be verbose. In many cases, the original source code (available online) has been reformatted; we’ve added line breaks and reworked indentation to accommodate the available page space in the book. In rare cases even this was not enough, and listings include line-continuation markers. Addi- tionally, many comments and JavaBean setters and getters have been removed from the listings. Code annotations accompany some of the source code listings, highlighting important concepts. In a few cases, numbered bullets link to explanations that fol- low the listing. WebWork is an open source project released under the very liberal OpenSym- phony License. Directions for downloading WebWork, in source or binary form, are available from the WebWork web site: http://www.opensymphony.com/webwork. The source code for all the CaveatEmptor examples in this book is available from http://www.manning.com/lightbody. The CaveatEmptor example application is a derivativeoftheoneusedinHibernateinAction,foundathttp://caveatemptor.hiber- nate.org. You can find many versions of CaveatEmptor, using various deployment techniques (EJB, non-EJB), but the one found at the Manning web site should be the one you use as the companion to this book. Once you’re finished reading the book, we highly recommend taking a peak at other versions of CaveatEmptor if you’re at all curious about Hibernate or future versions of WebWork. Author Online Purchase of WebWork in Action includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask techni- cal questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to http://www.man- ning.com/lightbody. This page provides information on how to get on the forum Licensed to Shirong Chen <[email protected]>
  • 31. ABOUT THIS BOOK xxv once you are registered, what kind of help is available, and the rules of conduct on the forum. Manning’s commitment to our readers is to provide a venue where a meaning- ful dialog between individual readers and between readers and the authors can take place. It is not a commitment to any specific amount of participation on the part of the authors, whose contribution to the AO remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions lest their interest stray! The Author Online forum and the archives of previous discussions will be accessible from the publisher’s web site as long as the book is in print. About the authors PATRICK LIGHTBODY Heading up Jive Software's Professional Services organiza- tion, Patrick has worked for various technology companies, ranging from well-estab- lished giants such as Cisco Systems to tiny Silicon Valley startups. He is the author of Java Open Source Programming and spends his spare time contributing to var- ious OpenSymphony projects, including WebWork and OSWorkflow. While he grew up in the heart of the Silicon Valley, Patrick now resides in Portland, Oregon. JASON CARREIRA Jason has been developing and architecting J2EE applications for six years. For the last five, he’s been designing and building enterprise finan- cial software products from the ground up. He recently joined ePlus where he is working on the next generation of eProcurement solutions. In his spare time, Jason is a core developer of the XWork command pattern framework and Web- Work MVC web framework at OpenSymphony. He lives in Rochester, New York, with his wife Cyndy and three children. Licensed to Shirong Chen <[email protected]>
  • 32. xxvi a look at the future In the open source world, innovation never stops. Although this can be a great thing, it can make it terribly difficult for people to keep up—even more so in the printed media. When we began working on this book over a year ago, WebWork 2.1 was just coming out and had huge momentum behind it. Today, WebWork 2.2 is just around the corner, and many new things are coming with it. With that in mind, we specifically focused this book on things we knew would be important no matter what version of WebWork you’re using—or even if you aren’t using WebWork at all. The concepts and techniques introduced here—such as decoupled validation and type conversion—are important in any web environment. This book is based on WebWork 2.1.7, but we took several steps to prepare you for the upgrade to 2.2. Most important, we use the optional altSyntax feature in WebWork 2.1.7 that will become standard in 2.2 and beyond. This feature simpli- fies how the tag libraries work. Because this feature was optional in 2.1, it’s extremely important that you enable it before attempting to use any of the exam- ples in this book. In chapter 3, “Setting up WebWork,” we show you how to enable this feature. Another step we took to make sure concepts learned here can be taken beyond the pages of this book is to use derivative of the sample application used in Hiber- nate in Action. Both the Hibernate and WebWork teams have committed to improving and evolving CaveatEmptor; so, after you’re finished reading this book, you can look at new versions of CaveatEmptor to see how the same application was built using WebWork 2.2 features. Licensed to Shirong Chen <[email protected]>
  • 33. xxvii about the title By combining introductions, overviews, and how-to examples, the In Action books are designed to help learning and remembering. According to research in cogni- tive science, the things people remember are things they discover during self- motivated exploration. Although no one at Manning is a cognitive scientist, we are convinced that for learning to become permanent it must pass through stages of exploration, play, and, interestingly, retelling of what is being learned. People understand and remember new things, which is to say they master them, only after actively explor- ing them. Humans learn in action. An essential part of an In Action guide is that it is example-driven. It encourages the reader to try things out, to play with new code, and explore new ideas. There is another, more mundane, reason for the title of this book: our readers are busy. They use books to do a job or to solve a problem. They need books that allow them to jump in and jump out easily and learn just what they want just when they want it. They need books that aid them in action. The books in this series are designed for such readers. Licensed to Shirong Chen <[email protected]>
  • 34. xxviii about the cover illustration The figure on the cover of WebWork in Action is a “Dancer from Constantinople.” The illustration is taken from a collection of costumes of the Ottoman Empire published on January 1, 1802, by William Miller of Old Bond Street, London. The title page is missing from the collection and we have been unable to track it down to date. The book’s table of contents identifies the figures in both English and French, and each illustration bears the names of two artists who worked on it, both of whom would no doubt be surprised to find their art gracing the front cover of a computer programming book...two hundred years later. The collection was purchased by a Manning editor at an antiquarian flea mar- ket in the “Garage” on West 26th Street in Manhattan. The seller was an American based in Ankara, Turkey, and the transaction took place just as he was packing up his stand for the day. The Manning editor did not have on his person the substan- tial amount of cash that was required for the purchase and a credit card and check were both politely turned down. With the seller flying back to Ankara that evening the situation was getting hopeless. What was the solution? It turned out to be nothing more than an old- fashioned verbal agreement sealed with a handshake. The seller simply proposed that the money be transferred to him by wire and the editor walked out with the bank information on a piece of paper and the portfolio of images under his arm. Needless to say, we transferred the funds the next day, and we remain grateful and Licensed to Shirong Chen <[email protected]>
  • 35. ABOUT THE COVER ILLUSTRATION xxix impressed by this unknown person’s trust in one of us. It recalls something that might have happened a long time ago. The pictures from the Ottoman collection, like the other illustrations that appear on our covers, bring to life the richness and variety of dress customs of two centuries ago. They recall the sense of isolation and distance of that period‹and of every other historic period except our own hyperkinetic present. Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now often hard to tell the inhabitant of one continent from another. Perhaps, trying to view it optimistically, we have traded a cultural and visual diversity for a more varied personal life. Or a more varied and interest- ing intellectual and technical life. We at Manning celebrate the inventiveness, the initiative, and, yes, the fun of the computer business with book covers based on the rich diversity of regional life of two centuries ago, brought back to life by the pictures from this collection. Licensed to Shirong Chen <[email protected]>
  • 37. Part 1 Introduction to WebWork This part of the book eases you into the basics of WebWork and the problems it tries to solve. Chapter 1 looks at the high-level architecture of WebWork and why the Model-View Controller design pattern helps when you’re building web appli- cations. In chapter 2, we apply these concepts in a concrete manner and walk you through the creation of a simple read-only WebWork example. We then modify that example and add data input and validation and the corresponding page workflow. Once you’re comfortable building basic web apps, we examine the vari- ous forms of configuration you can use to build your own applications. Licensed to Shirong Chen <[email protected]>
  • 39. 3 An overview of WebWork This chapter covers ■ Why MVC is important ■ Frameworks and containers ■ WebWork’s background and future ■ The CaveatEmptor sample application Licensed to Shirong Chen <[email protected]>
  • 40. 4 CHAPTER 1 An overview of WebWork Imagine you just built an entire web application and shipped version 1.0. Your biggest customer is now demanding that in version 1.1, the user interface must change dramatically to fit with their corporate usability standards—everything from the number of fields in data-entry forms to button and image locations to the number of steps in various wizards. And the customer wants the changes made by next week. Depending on how your web application was built, you might not even break a sweat. Or, you might be beefing up your resume. In the early days of building web applications, developers often used scripting languages like Perl and printed out content they wanted to display directly within their scripts—the same place where critical business logic was located. It soon became clear that this technique too tightly coupled the core business code with the presentation. These days, libraries exist for Perl, PHP, JSP, ASP, and every other web-enabled pro- gramming language, to try to solve the problem of separating business code from presentation code. Depending on the library you use and how well you’ve taken advantage of it, fulfilling your customer’s demands might be a walk in the park. In this book, you’ll learn how to use one of Java’s most popular web frame- works: WebWork. WebWork is an advanced framework based on the philosophy that common tasks should be easy to do and advanced designs should be possible to build. More than anything, the developers of WebWork wanted to provide a framework that works for you, not against you. To help you learn WebWork, we’ll show you how we utilized its basic and advanced features to build a second-generation version of the sample application used in the book Hibernate in Action (Manning Publications, 2004, www.man- ning.com/bauer). Hibernate is an Object-Relational Mapping (ORM) framework that provides easy database access. The authors, Christian Bauer and Gavin King, demonstrated the features of Hibernate using an online auction application named CaveatEmptor. Although CaveatEmptor is a complete application, it lacks any sort of web-based interface. In this book, we’ll demonstrate how we used the features of WebWork to add a web front end on top of the original CaveatEmptor code. We chose to introduce WebWork and its features this way for several reasons. First, many WebWork users also use Hibernate, so expanding on CaveatEmptor allows the community to see optimal ways to integrate the two. In addition, the original CaveatEmptor applica- tion contains no web user interface, and many readers of Hibernate in Action might want to learn how to add one. Those who know how to write back-end code quite well but aren’t experts with the front end can consult this book to see how it’s done. Licensed to Shirong Chen <[email protected]>
  • 41. Why MVC is important 5 However, before we can explore WebWork’s features and CaveatEmptor, we’ll first examine the general ideas behind web application frameworks. In chapter 2, “HelloWorld, the WebWork way,” we’ll walk through the familiar “Hello, World” tutorial to show you the basics of using WebWork. For the remainder of the book, we’ll focus entirely on WebWork’s features and how we used them in the CaveatEmptor application. But before we can do that, you need to understand what WebWork is and what it’s trying to accomplish. At the core, WebWork solves the problem of separating presentation logic from domain logic. But what does that mean? Why is it impor- tant? Where did this concept come from? More to the point, what is MVC, the pat- tern on which WebWork is based? 1.1 Why MVC is important The issue of separating the domain model from presentation isn’t unique to web applications. The Model-View-Controller (MVC) pattern was originally developed by the SmallTalk community to solve this problem for desktop GUI applications. MVC seeks to break an application into three parts and define the interactions between these components, thereby limiting the coupling between them and allowing each one to focus on its specific responsibilities without worrying about the others. Although the original MVC pattern worked well for desktop GUI applications, it failed to map directly to the World Wide Web. As developers continued to refine their web development techniques, MVC variations evolved to address the behav- iors specific to the request/response model that makes up the HyperText Trans- port Protocol (HTTP). The core concerns of MVC haven’t changed as these evolutions have taken place, and WebWork continues to champion the same moti- vations that SmallTalk developers faced decades ago. MVC tries to keep the more generally reusable domain model code and the view-specific code from being too aware of each other. It does this by introducing a controller to sit between the view and the model. The controller handles events from the view, such as button clicks, and maps them to model changes. The con- troller also registers the view to receive notifications of changes to the domain model, so that the view can refresh. This allows, for instance, a different view to be applied without changing the underlying model or controller layers. MVC frameworks have become the dominant architecture for web application development. WebWork is an MVC framework. Other popular Java-based MVC web application frameworks include Struts (no longer in active development), Tapes- try, RIFE, and JavaServer Faces (JSF). Before we look at web-based MVC designs, Licensed to Shirong Chen <[email protected]>
  • 42. 6 CHAPTER 1 An overview of WebWork let’s briefly examine the original MVC design that was used for desktop GUI appli- cations. Knowing the flow of the original MVC will help you understand the importance of the changes and updates MVC has faced as it has been applied to WebWork—and, specifically, as it’s implemented in WebWork. 1.1.1 Classic MVC becomes outdated Figure 1.1 shows the event flow in classic MVC. The user interacts with the view, filling in data and clicking buttons. The controller receives events from the view and performs actions on the model, updating it with the data the user has pro- vided. The view is notified of model-change events so that it can refresh from the model, showing the result of their work back to the user. Multiple views and con- trollers may be configured to use the same shared model by registering more event listeners. This pattern works well for applications where the entire applica- tion runs on the user’s machine and everything runs and is refreshed in real time. The classic MVC pattern breaks down, however, in the Web world, where the view is rendered in a browser on the client side while the controller and model are on the server. Figure 1.1 shows a very clean design approach. Unfortunately, it doesn’t work in the world of HTTP and HTML. Instead, web applications, using an HTTP request/response model, require a very different dwesign that borrows its name and some aspects from classic MVC. Controller View Model View Event Client Refresh View State Change Eve n t Change M o d e l Interact Figure 1.1 Event flow for the classic MVC pattern Licensed to Shirong Chen <[email protected]>
  • 43. Why MVC is important 7 1.1.2 Classic MVC gets an update: the Front Controller In the web version of MVC, views can’t make direct calls to controllers, as shown in figure 1.1, but are mapped based on web requests to URLs. The view isn’t an object to be updated, but a web page that is redrawn only when the client makes a new request. The model also can’t notify the view about changes, because it’s rendered in the user’s browser on a different machine; so, the view is forced to re-render every time for all the latest data. Figure 1.2 shows the event flow in MVC as it’s applied to web application frameworks. The classic application of MVC to the Web world is imple- mented using the Front Controller pat- tern. This involves a dispatcher (implemented as a servlet in Java web MVC implementations) that maps request URLs to command instances to be executed. The command instances, which are actions in WebWork or Struts, interact with backend services of the sys- tem, which can be generally grouped together as the model. The command instance returns a return code after doing its processing, which is mapped to a view (usually a web page template such as a JSP). The view is provided with the controller and model to render for the user and often uses custom tag libraries to easily access these values. 1.1.3 MVC evolves: the Page Controller A somewhat different implementation of MVC has been popularized by frame- works like Microsoft’s ASP.NET1 . Rather than have requests go through a dispatcher to look up a controller to execute, the view is hit directly and calls its controller before continuing to render. Although this pattern gives up some of the decoupled nature of a more classic MVC implementation, it should gain in productivity and tool support (especially in Microsoft Visual Studio). This type of development can Controller View Model Client Dispatcher Request Render Execute Change Model Refres h View Figure 1.2 Event flow for MVC in a web application framework Licensed to Shirong Chen <[email protected]>
  • 44. 8 CHAPTER 1 An overview of WebWork also be supported by WebWork by using the <webwork:action> custom tag (see chapter 9, “Tag libraries,” for a discussion of the WebWork tag library). Front Controller versus Page Controller Figures 1.3 and 1.4 show how a dashboard might be implemented differently using the Front Controller or Page Controller design. The Page Controller may look more modular due to the split of the X, Y, and Z responsibilities, but good use of object-oriented design could allow for a modular Front Controller design as well. If you’re familiar with Struts, the Front Controller pattern will look very familiar. Even if you aren’t familiar with other web frameworks, this technique should seem to be the most linear way to gather data and present it. However, some frame- works are embracing the Page Controller, shown in figure 1.4, because of the way it encourages encapsulation. Fortunately, WebWork supports both implementa- tions, giving you the best of both worlds. In our experience, frameworks can greatly increase your productivity. In order to meet your customers’ requirements and be ready for all the challenges an 1 Microsoft has an interesting discussion of presentation tier design patterns at http://msdn.mi- crosoft.com/practices/type/Patterns/Enterprise/EspWebPresentationPatterns/. They include both the Page Controller and Front Controller patterns; but the Page Controller is built into their frame- work, whereas a Front Controller implementation must be built from scratch. Dashboard Web Browser XYZ Action Request Response Push Push Push Figure 1.3 A dashboard implemented using the Front Controller MVC design Licensed to Shirong Chen <[email protected]>
  • 45. Understanding frameworks and containers 9 ever-changing business world throws at you, we recommend that you take advantage of the MVC design pattern when building web applications. Rather than build an MVC framework from scratch, most developers choose to leverage an existing one, such as WebWork. 1.2 Understanding frameworks and containers WebWork is, at its very heart, an MVC framework. But it’s also a lightweight con- tainer. To help you better understand the difference between a framework and a container, we’re going to look at the functionality each one provides as well as sev- eral alternative or related technologies for both categories. 1.2.1 What is a framework? When he was building the original version of WebWork, Rickard Öberg (the cre- ator of WebWork and co-founder of JBoss) said, “A framework’s power comes not from what it allows, but from what it does not allow.” What Rickard meant explains what a framework is: Frameworks are meant to bring structure to what would otherwise be chaos. In the case of web application frameworks, the goal is to encourage developers to use a supplied set of base classes and tag libraries, thereby avoiding a potential mess of tangled JSPs. view.jsp Web Browser Y Action Request Z Action X Action Request Request Request Response Response Response Response Figure 1.4 A dashboard implemented using the Page Controller MVC design Licensed to Shirong Chen <[email protected]>
  • 46. Exploring the Variety of Random Documents with Different Content
  • 47. All the while he spoke he exquisitely stroked the rounded tail, till it seemed as if a slippery sort of fire came from it into his hands. And his fingertips touched the two secret openings to her body, time after time, with a soft little brush of fire. "An' if tha shits an' if tha pisses, I'm glad. I don't want a woman as couldna shit nor piss." Connie could not help a sudden snort of astonished laughter, but he went on unmoved. "Tha'rt real, tha art! Tha'rt real, even a bit of a bitch. Here tha shits an' here tha pisses: an' I lay my hand on 'em both an' like thee for it. I like thee for it. Tha's got a proper, woman's arse, proud of itself. It's none ashamed of itself, this isna." He laid his hand close and firm over her secret places, in a kind of close greeting. "I like it," he said. "I like it! An' if I only lived ten minutes, an' stroked thy arse an' got to know it, I should reckon I'd lived one life, sees ter! Industrial system or not! Here's one o' my lifetimes." She turned round and climbed into his lap, clinging to him. "Kiss me!" she whispered. And she knew the thought of their separation was latent in both their minds, and at last she was sad. She sat on his thighs, her head against his breast, and her ivory- gleaming legs loosely apart, the fire glowing unequally upon them. Sitting with his head dropped, he looked at the folds of her body in the fireglow, and at the fleece of soft brown hair that hung down to a point between her open thighs. He reached to the table behind, and took up her bunch of flowers, still so wet that drops of rain fell on to her. "Flowers stops out of doors all weathers," he said. "They have no houses." "Not even a hut!" she murmured.
  • 48. With quiet fingers he threaded a few forget-me-not flowers in the fine brown fleece of the mount of Venus. "There!" he said. "There's forget-me-nots in the right place!" She looked down at the milky odd little flowers among the brown maiden-hair at the lower tip of her body. "Doesn't it look pretty!" she said. "Pretty as life," he replied. And he stuck a pink campion bud among the hair. "There! That's me where you won't forget me! That's Moses in the bulrushes." "You don't mind, do you, that I'm going away?" she asked wistfully, looking up into his face. But his face was inscrutable, under the heavy brows. He kept it quite blank. "You do as you wish," he said. And he spoke in good English. "But I won't go if you don't wish it," she said, clinging to him. There was silence. He leaned and put another piece of wood on the fire. The flame glowed on his silent, abstracted face. She waited, but he said nothing. "Only I thought it would be a good way to begin a break with Clifford. I do want a child. And it would give me a chance to, to—" she resumed. "To let them think a few lies," he said. "Yes, that among other things. Do you want them to think the truth?" "I don't care what they think." "I do! I don't want them handling me with their unpleasant cold minds, not while I'm still at Wragby. They can think what they like when I'm finally gone."
  • 49. He was silent. "But Sir Clifford expects you to come back to him?" "Oh, I must come back," she said: and there was silence. "And would you have a child in Wragby?" he asked. She closed her arm round his neck. "If you wouldn't take me away, I should have to," she said. "Take you where to?" "Anywhere! away! But right away from Wragby." "When?" "Why, when I come back." "But what's the good of coming back, doing the thing twice, if you're once gone?" he said. "Oh, I must come back. I've promised! I've promised so faithfully. Besides, I come back to you, really." "To your husband's gamekeeper?" "I don't see that that matters," she said. "No?" He mused a while. "And when would you think of going away again, then; finally? When exactly?" "Oh, I don't know. I'd come back from Venice. And then we'd prepare everything." "How prepare?" "Oh, I'd tell Clifford. I'd have to tell him." "Would you!" He remained silent. She put her arms fast round his neck. "Don't make it difficult for me," she pleaded. "Make what difficult?" "For me to go to Venice and arrange things."
  • 50. A little smile, half a grin, flickered on his face. "I don't make it difficult," he said. "I only want to find out just what you are after. But you don't really know yourself. You want to take time: get away and look at it. I don't blame you. I think you're wise. You may prefer to stay mistress of Wragby. I don't blame you. I've no Wragbys to offer. In fact, you know what you'll get out of me. No, no, I think you're right! I really do! And I'm not keen on coming to live on you, being kept by you. There's that too." She felt, somehow, as if he were giving her tit for tat. "But you want me, don't you?" she asked. "Do you want me?" "You know I do. That's evident." "Quite! And when do you want me?" "You know we can arrange it all when I come back. Now I'm out of breath with you. I must get calm and clear." "Quite! Get calm and clear!" She was a little offended. "But you trust me, don't you?" she said. "Oh, absolutely!" She heard the mockery in his tone. "Tell me, then," she said flatly; "do you think it would be better if I don't go to Venice?" "I'm sure it's better if you do go to Venice," he replied in the cool, slightly mocking voice. "You know it's next Thursday?" she said. "Yes!" She now began to muse. At last she said: "And we shall know better where we are when I come back, shan't we?"
  • 51. "Oh, surely!" The curious gulf of silence between them! "I've been to the lawyer about my divorce," he said, a little constrainedly. She gave a slight shudder. "Have you!" she said. "And what did he say?" "He said I ought to have done it before; that may be a difficulty. But since I was in the army, he thinks it will go through all right. If only it doesn't bring her down on my head!" "Will she have to know?" "Yes! she is served with a notice: so is the man she lives with, the co-respondent." "Isn't it hateful, all the performances! I suppose I'd have to go through it with Clifford." There was a silence. "And of course," he said, "I have to live an exemplary life for the next six or eight months. So if you go to Venice, there's temptation removed for a week or two, at least." "Am I temptation!" she said, stroking his face. "I'm so glad I'm temptation to you! Don't let's think about it! You frighten me when you start thinking: you roll me out flat. Don't let's think about it. We can think so much when we are apart. That's the whole point! I've been thinking, I must come to you for another night before I go. I must come once more to the cottage. Shall I come on Thursday night?" "Isn't that when your sister will be there?" "Yes! But she said we would start at teatime. So we could start at teatime. But she could sleep somewhere else and I could sleep with you." "But then she'd have to know."
  • 52. "Oh, I shall tell her. I've more or less told her already. I must talk it all over with Hilda. She's a great help, so sensible." He was thinking of her plan. "So you'd start off from Wragby at teatime, as if you were going to London? Which way were you going?" "By Nottingham and Grantham." "And then your sister would drop you somewhere and you'd walk or drive back here? Sounds very risky, to me." "Does it? Well then, Hilda could bring me back. She could sleep at Mansfield, and bring me back here in the evening, and fetch me again in the morning. It's quite easy." "And the people who see you?" "I'll wear goggles and a veil." He pondered for some time. "Well," he said. "You please yourself, as usual." "But wouldn't it please you?" "Oh, yes! It'd please me all right," he said a little grimly. "I might as well smite while the iron's hot." "Do you know what I thought?" she said suddenly. "It suddenly came to me. You are the 'Knight of the Burning Pestle'!" "Ay! And you? Are you the Lady of the Red-Hot Mortar?" "Yes!" she said. "Yes! You're Sir Pestle and I'm Lady Mortar." "All right, then I'm knighted. John Thomas is Sir John, to your Lady Jane." "Yes! John Thomas is knighted! I'm my-lady-maiden-hair, and you must have flowers too. Yes!" She threaded two pink campions in the bush of red-gold hair above his penis. "There!" she said. "Charming! Charming! Sir John!"
  • 53. And she pushed a bit of forget-me-not in the dark hair of his breast. "And you won't forget me there, will you?" she kissed him on the breast, and made two bits of forget-me-not lodge one over each nipple, kissing him again. "Make a calendar of me!" he said. He laughed, and the flowers shook from his breast. "Wait a bit!" he said. He rose, and opened the door of the hut. Flossie, lying in the porch, got up and looked at him. "Ay, it's me!" he said. The rain had ceased. There was a wet, heavy, perfumed stillness. Evening was approaching. He went out and down the little path in the opposite direction from the riding. Connie watched his thin, white figure, and it looked to her like a ghost, an apparition moving away from her. When she could see it no more, her heart sank. She stood in the door of the hut, with a blanket round her, looking into the drenched, motionless silence. But he was coming back, trotting strangely, and carrying flowers. She was a little afraid of him, as if he were not quite human. And when he came near, his eyes looked into hers, but she could not understand the meaning. He had brought columbines and campions, and new-mown hay, and oak-tufts and honeysuckle in small bud. He fastened fluffy young oak-sprays round her breasts, sticking in tufts of bluebells and campion: and in her navel he poised a pink campion flower, and in her maiden-hair were forget-me-nots and woodruff. "That's you in all your glory!" he said. "Lady Jane, at her wedding with John Thomas." And he stuck flowers in the hair of his own body, and wound a bit of creeping-jenny round his penis, and stuck a single bell of a hyacinth in his navel. She watched him with amusement, his odd intentness.
  • 54. And she pushed a campion flower in his moustache, where it stuck, dangling under his nose. "This is John Thomas marryin' Lady Jane," he said. "An' we mun let Constance an' Oliver go their ways. Maybe—" He spread out his hand with a gesture, and then he sneezed, sneezing away the flowers from his nose and his navel. He sneezed again. "Maybe what?" she said, waiting for him to go on. He looked at her a little bewildered. "Eh?" he said. "Maybe what? Go on with what you were going to say," she insisted. "Ay, what was I going to say?" He had forgotten. And it was one of the disappointments of her life, that he never finished. A yellow ray of sun shone over the trees. "Sun!" he said. "And time you went. Time, my lady, time! What's that as flies without wings, your ladyship? Time! Time!" He reached for his shirt. "Say good night! to John Thomas," he said, looking down at his penis. "He's safe in the arms of creeping-jenny! Not much burning pestle about him just now." And he put his flannel shirt over his head. "A man's most dangerous moment," he said, when his head had emerged, "is when he's getting into his shirt. Then he puts his head in a bag. That's why I prefer those American shirts, that you put on like a jacket." She still stood watching him. He stepped into his short drawers, and buttoned them round the waist. "Look at Jane!" he said. "In all her blossoms! Who'll put blossoms on you next year, Jinny? Me, or somebody else? 'Good-bye my bluebell, farewell to you!' I hate that song, it's early war days." He
  • 55. had sat down, and was pulling on his stockings. She still stood unmoving. He laid his hand on the slope of her buttocks. "Pretty little Lady Jane!" he said. "Perhaps in Venice you'll find a man who'll put jasmine in your maiden-hair, and a pomegranate flower in your navel. Poor little Lady Jane!" "Don't say those things!" she said. "You only say them to hurt me." He dropped his head. Then he said, in dialect: "Ay, maybe I do, maybe I do! Well then, I'll say nowt, an' ha' done wi't. But tha mun dress thysen, an' go back to thy stately homes of England, how beautiful they stand. Time's up! Time's up for Sir John, an' for little Lady Jane! Put thy shimmy on, Lady Chatterley! Tha might be anybody, standin' there be-out even a shimmy, an' a few rags o' flowers. There then, there then, I'll undress thee, tha bob- tailed young throstle." And he took the leaves from her hair, kissing her damp hair, and the flowers from her breasts, and kissed her breasts, and kissed her navel, and kissed her maiden-hair, where he left the flowers threaded. "They mun stop while they will," he said. "So! There tha'rt bare again, nowt but a bare-arsed lass an' a bit of a Lady Jane! Now put thy shimmy on, for tha mun go, or else Lady Chatterley's going to be late for dinner, an' where 'ave yer been to my pretty maid!" She never knew how to answer him when he was in this condition of the vernacular. So she dressed herself and prepared to go a little ignominiously home to Wragby. Or so she felt it: a little ignominiously home. He would accompany her to the broad riding. His young pheasants were all right under the shelter. When he and she came out on to the riding, there was Mrs. Bolton faltering palely towards them. "Oh, my Lady, we wondered if anything had happened!" "No! Nothing has happened." Mrs. Bolton looked into the man's face, that was smooth and new- looking with love. She met his half-laughing, half-mocking eyes. He
  • 56. always laughed at mischance. But he looked at her kindly. "Evening, Mrs. Bolton! Your Ladyship will be all right now, so I can leave you. Good night to your ladyship! Good night, Mrs. Bolton!" He saluted and turned away. CHAPTER XVI Connie arrived home to an ordeal of cross-questioning. Clifford had been out at teatime, had come in just before the storm, and where was her ladyship? Nobody knew, only Mrs. Bolton suggested she had gone for a walk into the wood. Into the wood, in such a storm! Clifford for once let himself get into a state of nervous frenzy. He started at every flash of lightning, and blenched at every roll of thunder. He looked at the icy thunder-rain as if it were the end of the world. He got more and more worked up. Mrs. Bolton tried to soothe him. "She'll be sheltering in the hut, till it's over. Don't worry, her ladyship is all right." "I don't like her being in the wood in a storm like this! I don't like her being in the wood at all! She's been gone now more than two hours. When did she go out?" "A little while before you came in." "I didn't see her in the park. God knows where she is and what has happened to her." "Oh, nothing's happened to her. You'll see, she'll be home directly after the rain stops. It's just the rain that's keeping her." But her ladyship did not come home directly the rain stopped. In fact time went by, the sun came out for his last yellow glimpse, and there still was no sign of her. The sun was set, it was growing dark, and the first dinner-gong had rung.
  • 57. "It's no good!" said Clifford in a frenzy. "I'm going to send out Field and Betts to find her." "Oh, don't do that!" cried Mrs. Bolton. "They'll think there's suicide or something. Oh, don't start a lot of talk going—Let me slip over to the hut and see if she's not there. I'll find her all right." So, after some persuasion, Clifford allowed her to go. And so Connie had come upon her in the drive, alone and palely loitering. "You mustn't mind me coming to look for you, my Lady! But Sir Clifford worked himself up into such a state. He made sure you were struck by lightning, or killed by a falling tree. And he was determined to send Field and Betts to the wood to find the body. So I thought I'd better come, rather than set all the servants agog." She spoke nervously. She could still see on Connie's face the smoothness and the half-dream of passion, and she could feel the irritation against herself. "Quite!" said Connie. And she could say no more. The two women plodded on through the wet world, in silence, while great drops splashed like explosions in the wood. When they came to the park, Connie strode ahead, and Mrs. Bolton panted a little. She was getting plumper. "How foolish of Clifford to make a fuss!" said Connie at length, angrily, really speaking to herself. "Oh, you know what men are! They like working themselves up. But he'll be all right as soon as he sees your ladyship." Connie was very angry that Mrs. Bolton knew her secret: for certainly she knew it. Suddenly Constance stood still on the path. "It's monstrous that I should have to be followed!" she said, her eyes flashing.
  • 58. "Oh! your Ladyship, don't say that! He'd certainly have sent the two men, and they'd have come straight to the hut. I didn't know where it was, really." Connie flushed darker with rage, at the suggestion. Yet, while her passion was on her, she could not lie. She could not even pretend there was nothing between herself and the keeper. She looked at the other woman, who stood so sly, with her head dropped: yet somehow, in her femaleness, an ally. "Oh well!" she said. "If it is so, it is so. I don't mind!" "Why, you're all right, my Lady! You've only been sheltering in the hut. It's absolutely nothing." They went on to the house. Connie marched in to Clifford's room, furious with him, furious with his pale, over-wrought face and prominent eyes. "I must say, I don't think you need send the servants after me!" she burst out. "My God!" he exploded. "Where have you been, woman? You've been gone hours, hours, and in a storm like this! What the hell do you go to that bloody wood for? What have you been up to? It's hours even since the rain stopped, hours! Do you know what time it is? You're enough to drive anybody mad. Where have you been? What in the name of hell have you been doing?" "And what if I don't choose to tell you?" She pulled her hat from her head and shook her hair. He looked at her with his eyes bulging, and yellow coming into the whites. It was very bad for him to get into these rages: Mrs. Bolton had a weary time with him, for days after. Connie felt a sudden qualm. "But really!" she said, milder, "Anyone would think I'd been I don't know where! I just sat in the hut during all the storm, and made myself a little fire, and was happy." She spoke now easily. After all, why work him up any more! He looked at her suspiciously.
  • 59. "And look at your hair!" he said; "look at yourself!" "Yes!" she replied calmly. "I ran out in the rain with no clothes on." He stared at her speechless. "You must be mad!" he said. "Why? To like a shower-bath from the rain?" "And how did you dry yourself?" "On an old towel and at the fire." He still stared at her in a dumbfounded way. "And supposing anybody came," he said. "Who would come?" "Who? Why anybody! And Mellors. Does he come? He must come in the evenings." "Yes, he came later, when it had cleared up, to feed the pheasants with corn." She spoke with amazing nonchalance. Mrs. Bolton, who was listening in the next room, heard in sheer admiration. To think a woman could carry it off so naturally! "And suppose he'd come while you were running about in the rain with nothing on, like a maniac?" "I suppose he'd have had the fright of his life, and cleared out as fast as he could." Clifford still stared at her transfixed. What he thought in his under- consciousness he would never know. And he was too much taken aback to form one clear thought in his upper-consciousness. He just simply accepted what she said, in a sort of blank. And he admired her. He could not help admiring her. She looked so flushed and handsome and smooth: love smooth. "At least," he said, subsiding, "you'll be lucky if you've got off without a severe cold."
  • 60. "Oh, I haven't got a cold," she replied. She was thinking to herself of the other man's words: Tha's got the nicest woman's arse of anybody! She wished, she dearly wished she could tell Clifford that this had been said her, during the famous thunderstorm. However! She bore herself rather like an offended queen, and went upstairs to change. That evening, Clifford wanted to be nice to her. He was reading one of the latest scientific-religious books: he had a streak of a spurious sort of religion in him, and was egocentrically concerned with the future of his own ego. It was like his habit to make conversation to Connie about some book, since the conversation between them had to be made, almost chemically. They had almost chemically to concoct it in their heads. "What do you think of this, by the way?" he said, reaching for his book. "You'd have no need to cool your ardent body by running out in the rain, if only we had a few more aeons of evolution behind us. Ah here it is!—'The universe shows us two aspects: on one side it is physically wasting, on the other it is spiritually ascending.'" Connie listened, expecting more. But Clifford was waiting. She looked at him in surprise. "And if it spiritually ascends," she said, "what does it leave down below, in the place where its tail used to be?" "Ah!" he said. "Take the man for what he means. Ascending is the opposite of his wasting, I presume." "Spiritually blown out, so to speak!" "No, but seriously, without joking: do you think there is anything in it?" She looked at him again. "Physically wasting?" she said. "I see you getting fatter, and I'm not wasting myself. Do you think the sun is smaller than he used to be? He's not to me. And I suppose the apple Adam offered Eve wasn't really much bigger, if any, than one of our orange pippins. Do you think it was?"
  • 61. "Well, hear how he goes on: 'It is thus slowly passing, with a slowness inconceivable in our measures of time, to new creative conditions, amid which the physical world, as we at present know it, will be represented by a ripple barely to be distinguished from nonentity.'" She listened with a glisten of amusement. All sorts of improper things suggested themselves. But she only said: "What silly hocus-pocus! As if his little conceited consciousness could know what was happening as slowly as all that! It only means he's a physical failure on the earth, so he wants to make the whole universe a physical failure. Priggish little impertinence!" "Oh, but listen! Don't interrupt the great man's solemn words! 'The present type of order in the world has risen from an unimaginable past, and will find its grave in an unimaginable future. There remains the inexhaustive realm of abstract forms, and creativity with its shifting character ever determined afresh by its own creatures, and God, upon whose wisdom all forms of order depend.' There, that's how he winds up!" Connie sat listening contemptuously. "He's spiritually blown out," she said. "What a lot of stuff! Unimaginables, and types of order in graves, and realms of abstract forms, and creativity with a shifty character, and God mixed up with forms of order! Why it's idiotic!" "I must say, it is a little vaguely conglomerate, a mixture of gases, so to speak," said Clifford. "Still, I think there is something in the idea that the universe is physically wasting and spiritually ascending." "Do you? Then let it ascend, so long as it leaves me safely and solidly physically here below." "Do you like your physique?" he asked. "I love it!" And through her mind went the words: It's the nicest, nicest woman's arse as is! "But that is really rather extraordinary, because there's no denying it's an encumbrance. But then I suppose a woman doesn't take a
  • 62. supreme pleasure in the life of the mind." "Supreme pleasure?" she said, looking up at him. "Is that sort of idiocy the supreme pleasure of the life of the mind? No thank you! Give me the body. I believe the life of the body is a greater reality than the life of the mind: when the body is really wakened to life. But so many people, like your famous wind-machine, have only got minds tacked on to their physical corpses." He looked at her in wonder. "The life of the body," he said, "is just the life of the animals." "And that's better than the life of professional corpses. But it's not true! The human body is only just coming to real life. With the Greeks it gave a lovely flicker, then Plato and Aristotle killed it, and Jesus finished it off. But now the body is coming really to life, it is really rising from the tomb. And it will be a lovely, lovely life in the lovely universe, the life of the human body." "My dear, you speak as if you were ushering it all in! True, you are going away on a holiday: but don't please be quite so indecently elated about it. Believe me, whatever God there is is slowly eliminating the guts and alimentary system from the human being, to evolve a higher, more spiritual being." "Why should I believe you, Clifford, when I feel that whatever God there is has at last wakened up in my guts, as you call them, and is rippling so happily there, like dawn. Why should I believe you, when I feel so very much the contrary?" "Oh, exactly! And what has caused this extraordinary change in you? Running out stark naked in the rain, and playing Bacchante? Desire for sensation, or the anticipation of going to Venice?" "Both! Do you think it is horrid of me to be so thrilled at going off?" she said. "Rather horrid to show it so plainly." "Then I'll hide it."
  • 63. "Oh, don't trouble! You almost communicate a thrill to me. I almost feel that it is I who am going off." "Well, why don't you come?" "We've gone over all that. And as a matter of fact, I suppose your greatest thrill comes from being able to say a temporary farewell to all this. Nothing so thrilling, for the moment, as Good-bye-to-it-all! But every parting means a meeting elsewhere. And every meeting is a new bondage." "I'm not going to enter any new bondages." "Don't boast, while the gods are listening," he said. She pulled up short. "No! I won't boast!" she said. But she was thrilled, none the less, to be going off: to feel bonds snap. She couldn't help it. Clifford, who couldn't sleep, gambled all night with Mrs. Bolton, till she was too sleepy almost to live. And the day came round for Hilda to arrive. Connie had arranged with Mellors that if everything promised well for their night together, she would hang a green shawl out of the window. If there were frustration, a red one. Mrs. Bolton helped Connie to pack. "It will be so good for your ladyship to have a change." "I think it will. You don't mind having Sir Clifford on your hands alone for a time, do you?" "Oh, no! I can manage him quite all right. I mean, I can do all he needs me to do. Don't you think he's better than he used to be?" "Oh much! You do wonders with him." "Do I though! But men are all alike: just babies, and you have to flatter them and wheedle them and let them think they're having their own way. Don't you find it so, my Lady!"
  • 64. "I'm afraid I haven't much experience." Connie paused in her occupation. "Even your husband, did you have to manage him, and wheedle him like a baby?" she asked, looking at the other woman. Mrs. Bolton paused too. "Well!" she said. "I had to do a good bit of coaxing, with him too. But he always knew what I was after, I must say that. But he generally gave in to me." "He was never the lord and master thing?" "No! At least there'd be a look in his eyes sometimes, and then I knew I'd got to give in. But usually he gave in to me. No, he was never lord and master. But neither was I. I knew when I could go no further with him, and then I gave in: though it cost me a good bit, sometimes." "And what if you had held out against him?" "Oh, I don't know. I never did. Even when he was in the wrong, if he was fixed, I gave in. You see I never wanted to break what was between us. And if you really set your will against a man, that finishes it. If you care for a man, you have to give in to him once he's really determined; whether you're in the right or not, you have to give in. Else you break something. But I must say, Ted 'ud give in to me sometimes, when I was set on a thing, and in the wrong. So I suppose it cuts both ways." "And that's how you are with all your patients?" asked Connie. "Oh, that's different. I don't care at all, in the same way. I know what's good for them, or I try to, and then I just contrive to manage them for their own good. It's not like anybody as you're really fond of. It's quite different. Once you've been really fond of a man, you can be affectionate to almost any man, if he needs you at all. But it's not the same thing. You don't really care. I doubt, once you've really cared, if you can ever really care again." These words frightened Connie.
  • 65. "Do you think one can only care once?" she asked. "Or never. Most women never care, never begin to. They don't know what it means. Nor men either. But when I see a woman as cares, my heart stands still for her." "And do you think men easily take offence?" "Yes! If you wound them on their pride. But aren't women the same? Only our two prides are a bit different." Connie pondered this. She began again to have some misgiving about her going away. After all, was she not giving the man the go- by, if only for a short time? And he knew it. That's why he was so queer and sarcastic. Still! the human existence is a good deal controlled by the machine of external circumstance. She was in the power of this machine. She couldn't extricate herself all in five minutes. She didn't even want to. Hilda arrived in good time on Thursday morning, in a nimble two- seater car, with her suitcase strapped firmly behind. She looked as demure and maidenly as ever, but she had the same will of her own. She had the very hell of a will of her own, as her husband had found out. But the husband was now divorcing her. Yes, she even made it easy for him to do that, though she had no lover. For the time being, she was "off" men. She was very well content to be quite her own mistress: and mistress of her two children, whom she was going to bring up "properly," whatever that may mean. Connie was only allowed a suitcase, also. But she had sent on a trunk to her father, who was going by train. No use taking a car to Venice. And Italy much too hot to motor in, in July. He was going comfortably by train. He had just come down from Scotland. So, like a demure arcadian field-marshall, Hilda arranged the material part of the journey. She and Connie sat in the upstairs room, chatting. "But, Hilda!" said Connie, a little frightened. "I want to stay near here tonight. Not here: near here!"
  • 66. Hilda fixed her sister with grey, inscrutable eyes. She seemed so calm: and she was so often furious. "Where, near here?" she asked softly. "Well, you know I love somebody, don't you?" "I gathered there was something." "Well, he lives near here, and I want to spend this last night with him. I must! I've promised." Connie became insistent. Hilda bent her Minerva-like head in silence. Then she looked up. "Do you want to tell me who he is," she said. "He's our gamekeeper," faltered Connie, and she flushed vividly, like a shamed child. "Connie!" said Hilda, lifting her nose slightly with disgust: a motion she had from her mother. "I know: but he's lovely really. He really understands tenderness," said Connie, trying to apologise for him. Hilda, like a ruddy, rich-coloured Athena, bowed her head and pondered. She was really violently angry. But she dared not show it, because Connie, taking after her father, would straightway become obstreperous and unmanageable. It was true, Hilda did not like Clifford: his cool assurance that he was somebody! She thought he made use of Connie shamefully and impudently. She had hoped her sister would leave him. But, being solid Scotch middle class, she loathed any "lowering" of oneself, or the family. She looked up at last. "You'll regret it," she said. "I shan't," cried Connie, flushed red. "He's quite the exception. I really love him. He's lovely as a lover." Hilda still pondered.
  • 67. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com