| |
| |
Foreword | |
| |
| |
Preface | |
| |
| |
Acknowledgments | |
| |
| |
About this book | |
| |
| |
A look at the future | |
| |
| |
About the title | |
| |
| |
About the cover illustration | |
| |
| |
| |
Introduction to WebWork | |
| |
| |
| |
An overview of WebWork | |
| |
| |
| |
Why MVC is important | |
| |
| |
Classic MVC becomes outdated | |
| |
| |
Classic MVC gets an update: the Front Controller | |
| |
| |
MVC evolves: the Page Controller | |
| |
| |
| |
Understanding frameworks and containers | |
| |
| |
What is a framework? | |
| |
| |
What a container can do | |
| |
| |
| |
WebWork: past, present, and future | |
| |
| |
The history of WebWork | |
| |
| |
Understanding the XWork core | |
| |
| |
Future directions | |
| |
| |
| |
The CaveatEmptor application | |
| |
| |
How CaveatEmptor is organized | |
| |
| |
| |
Summary | |
| |
| |
| |
HelloWorld, the WebWork way | |
| |
| |
| |
Downloading WebWork | |
| |
| |
| |
Preparing the skeleton | |
| |
| |
Creating the web.xml deployment file | |
| |
| |
Creating the xwork.xml configuration file | |
| |
| |
Creating the webwork.properties configuration file | |
| |
| |
Tips for developing WebWork apps | |
| |
| |
| |
Your first action | |
| |
| |
Saying hello, the WebWork way | |
| |
| |
Displaying output to the web browser | |
| |
| |
Configuring your new action | |
| |
| |
| |
Dealing with inputs | |
| |
| |
| |
Advanced control flow | |
| |
| |
| |
Letting WebWork do the work | |
| |
| |
Taking advantage of ActionSupport | |
| |
| |
Intermediate modifications to the JSP | |
| |
| |
Exploring the UI tag library | |
| |
| |
| |
Summary | |
| |
| |
| |
Setting up WebWork | |
| |
| |
| |
Configuring actions, results, and interceptors | |
| |
| |
Overview of terminology | |
| |
| |
Actions | |
| |
| |
Results | |
| |
| |
Interceptors | |
| |
| |
| |
Advanced configuration | |
| |
| |
The xwork.xml DTD | |
| |
| |
Namespaces and packages | |
| |
| |
Componentization using the include tag | |
| |
| |
| |
Other configuration files | |
| |
| |
Web-app configuration: web.xml | |
| |
| |
Feature configuration: webwork.properties | |
| |
| |
| |
Setting up your web app | |
| |
| |
General layout | |
| |
| |
Required libraries | |
| |
| |
Optional libraries | |
| |
| |
| |
Summary | |
| |
| |
| |
Core concepts | |
| |
| |
| |
Implementing WebWork actions | |
| |
| |
| |
The Action interface | |
| |
| |
Result codes | |
| |
| |
Handling exceptions | |
| |
| |
| |
Using the ActionSupport base class | |
| |
| |
| |
Understanding basic validation | |
| |
| |
Validating an action: Validateable | |
| |
| |
Displaying error messages: ValidationAware | |
| |
| |
| |
Using localized message texts | |
| |
| |
Retrieving the user's locale: LocaleProvider | |
| |
| |
Displaying the localized text: TextProvider | |
| |
| |
Providing messages for other languages | |
| |
| |
| |
Advanced inputs | |
| |
| |
Intermediary objects | |
| |
| |
Using domain objects directly | |
| |
| |
| |
Working with ModelDriven actions | |
| |
| |
Implementing ModelDriven actions | |
| |
| |
Considerations when using ModelDriven | |
| |
| |
| |
Accessing data through the ActionContext | |
| |
| |
CaveatEmptor: accessing the session | |
| |
| |
Example: accessing the request and response | |
| |
| |
| |
Handling file uploads | |
| |
| |
Accessing uploaded files through the request wrapper | |
| |
| |
Automating file uploads | |
| |
| |
Configuration settings | |
| |
| |
| |
Summary | |
| |
| |
| |
Adding functionality with interceptors | |
| |
| |
| |
How interceptors are called | |
| |
| |
| |
Using the prepackaged interceptors | |
| |
| |
Utility interceptors | |
| |
| |
Setting parameters | |
| |
| |
Defining workflow | |
| |
| |
| |
Using prepackaged interceptor stacks | |
| |
| |
| |
Building your own interceptors | |
| |
| |
Using the AroundInterceptor as a base | |
| |
| |
Looking at an example custom interceptor | |
| |
| |
Getting callbacks before the result is executed with the PreResultListener | |
| |
| |
Looking out for interceptor interactions | |
| |
| |
| |
Interceptors vs. servlet filters | |
| |
| |
| |
Summary | |
| |
| |
| |
Inversion of Control | |
| |
| |
| |
Examining the pattern | |
| |
| |
Common patterns for active resource management | |
| |
| |
Inverting resource management | |
| |
| |
How IoC helps with testing | |
| |
| |
| |
IoC essentials | |
| |
| |
WebWork's IoC history | |
| |
| |
Dependencies | |
| |
| |
Scope and lifecycle | |
| |
| |
| |
Using WebWork's IoC framework | |
| |
| |
Configuration | |
| |
| |
Creating a new component | |
| |
| |
Using IoC on any object | |
| |
| |
Dealing with complex dependencies | |
| |
| |
| |
An example from CaveatEmptor | |
| |
| |
The HibernateSessionFactory component | |
| |
| |
The Persistence Manager component | |
| |
| |
Configuring the components | |
| |
| |
Using the new components | |
| |
| |
| |
Alternatives | |
| |
| |
Alternative IoC containers | |
| |
| |
Non-IoC alternatives | |
| |
| |
| |
Summary | |
| |
| |
| |
Displaying content | |
| |
| |
| |
Using results | |
| |
| |
| |
Life after the action | |
| |
| |
A simple result | |
| |
| |
Configuring a result | |
| |
| |
| |
Common results | |
| |
| |
Dispatching to a page | |
| |
| |
Redirecting to a page | |
| |
| |
Chaining to another action | |
| |
| |
| |
Other results | |
| |
| |
Streaming Velocity templates directly to the output | |
| |
| |
FreeMarker: an alternative to Velocity | |
| |
| |
Generating reports with JasperReports | |
| |
| |
| |
Summary | |
| |
| |
| |
Getting data with the expression language | |
| |
| |
| |
What is an expression language? | |
| |
| |
Why an expression language? | |
| |
| |
Why OGNL? | |
| |
| |
Other expression languages | |
| |
| |
Key OGNL concepts | |
| |
| |
| |
Basic expression language features | |
| |
| |
Accessing bean properties | |
| |
| |
Literals and operators | |
| |
| |
Calling methods | |
| |
| |
Setting values and expression lists | |
| |
| |
Accessing static methods and fields | |
| |
| |
Accessing the OGNL context and the ActionContext | |
| |
| |
| |
Working with collections | |
| |
| |
Working with lists and arrays | |
| |
| |
Working with maps | |
| |
| |
Filtering and projecting collections | |
| |
| |
The multiple uses of "#" | |
| |
| |
| |
Advanced expression language features | |
| |
| |
Linking the value stack to the expression language | |
| |
| |
Data type conversion | |
| |
| |
Handling null property access | |
| |
| |
Creating lambda expressions on the fly | |
| |
| |
| |
Summary | |
| |
| |
| |
Tag libraries | |
| |
| |
| |
Getting started | |
| |
| |
| |
An overview of WebWork tags | |
| |
| |
The WebWork tag syntax | |
| |
| |
| |
Data tags | |
| |
| |
The property tag | |
| |
| |
The set tag | |
| |
| |
The push tag | |
| |
| |
The bean tag | |
| |
| |
The action tag | |
| |
| |
| |
Control tags | |
| |
| |
The iterator tag | |
| |
| |
The if and else tags | |
| |
| |
| |
Miscellaneous tags | |
| |
| |
The include tag | |
| |
| |
The URL tag | |
| |
| |
The i18n and text tags | |
| |
| |
The param tag | |
| |
| |
| |
Summary | |
| |
| |
| |
Velocity | |
| |
| |
| |
Introduction to Velocity | |
| |
| |
What is Velocity? | |
| |
| |
Getting ready to use Velocity | |
| |
| |
| |
Basic syntax and operations | |
| |
| |
Property access | |
| |
| |
Method calls | |
| |
| |
Control statements: if/else and loops | |
| |
| |
Assigning variables | |
| |
| |
| |
Advanced techniques | |
| |
| |
The VelocityContext | |
| |
| |
WebWork-supplied objects in the context | |
| |
| |
Customizing the Velocity context | |
| |
| |
| |
Using JSP tags in Velocity | |
| |
| |
| |
Loading Velocity templates | |
| |
| |
| |
Summary | |
| |
| |
| |
UI components | |
| |
| |
| |
Why bother with UI tags? | |
| |
| |
Eliminating the pain | |
| |
| |
More than just form elements | |
| |
| |
| |
UI tag overview | |
| |
| |
Templates | |
| |
| |
Themes | |
| |
| |
Tag attributes | |
| |
| |
| |
UI tag reference | |
| |
| |
Common attributes | |
| |
| |
Simple tags | |
| |
| |
Collection-based tags | |
| |
| |
Advanced tags | |
| |
| |
| |
Summary | |
| |
| |
| |
Advanced topics | |
| |
| |
| |
Type conversion | |
| |
| |
| |
Why type conversion? | |
| |
| |
The Servlet specification | |
| |
| |
An action without type conversion | |
| |
| |
A view without type conversion | |
| |
| |
What WebWork's type conversion gives you | |
| |
| |
| |
Configuration | |
| |
| |
Role of a type converter | |
| |
| |
Global type converters | |
| |
| |
Class-level type converters | |
| |
| |
| |
Simple type conversion | |
| |
| |
Basic type conversion | |
| |
| |
Built-in type conversion | |
| |
| |
Handling null property access | |
| |
| |
| |
Advanced topics | |
| |
| |
Handling null Collection access | |
| |
| |
Handling conversion errors | |
| |
| |
An example that puts it all together | |
| |
| |
| |
Summary | |
| |
| |
| |
Validating form data | |
| |
| |
| |
Manually validating data | |
| |
| |
Validating in the execute() method | |
| |
| |
Implementing the Validateable interface | |
| |
| |
| |
Using the Validation Framework | |
| |
| |
Building your first *-validation.xml file | |
| |
| |
Registering validators | |
| |
| |
Applying the validation interceptor | |
| |
| |
Pulling it all together | |
| |
| |
Looking at some validation XML examples | |
| |
| |
| |
Exploring the advanced features of the Validation Framework | |
| |
| |
Implementing a custom validator | |
| |
| |
Validating with different contexts | |
| |
| |
Short-circuiting validation | |
| |
| |
The Expression Validator | |
| |
| |
Reusing validations with the visitor field validator | |
| |
| |
| |
Summary | |
| |
| |
| |
Internationalization | |
| |
| |
| |
Exploring a quick internationalization example | |
| |
| |
| |
Sources for messages | |
| |
| |
Understanding the ResourceBundle search order | |
| |
| |
Adding default resource bundles | |
| |
| |
The <ww:i18n> tag | |
| |
| |
| |
Using internationalized messages | |
| |
| |
Parameterizing localized texts | |
| |
| |
Using getText() in taglib attributes | |
| |
| |
Formatting dates and numbers | |
| |
| |
Using localized messages in validations | |
| |
| |
Using internationalized texts for type conversion messages | |
| |
| |
| |
Tips and tricks | |
| |
| |
Programmatically setting the locale | |
| |
| |
Implementing ResourceBundles as classes | |
| |
| |
Using the <ww:param> tag to pass dynamically generated text to message texts | |
| |
| |
Setting the encoding: here, there, and everywhere | |
| |
| |
A note on Java PropertyResourceBundles | |
| |
| |
A final note | |
| |
| |
| |
Summary | |
| |
| |
| |
Best practices | |
| |
| |
| |
Setting up your environment | |
| |
| |
Setting up your IDE | |
| |
| |
Reloading resources | |
| |
| |
| |
Unit-testing your actions | |
| |
| |
Using mock objects | |
| |
| |
The advantage of IoC for testing | |
| |
| |
Handling statics and ThreadLocals | |
| |
| |
| |
Putting the pieces together: integration testing | |
| |
| |
Testing your configuration | |
| |
| |
Seeing the configuration with the config browser | |
| |
| |
| |
Testing validations | |
| |
| |
Testing programmatic validations | |
| |
| |
Testing validation.xml files | |
| |
| |
| |
Advanced UI tag usage | |
| |
| |
Overriding existing templates | |
| |
| |
Writing custom templates | |
| |
| |
Writing custom themes | |
| |
| |
| |
Using form tokens to prevent duplicate form submissions | |
| |
| |
Using the <ww:token> tag | |
| |
| |
Applying the TokenInterceptor | |
| |
| |
Transparently re-rendering pages with the TokenSessionStoreInterceptor | |
| |
| |
| |
Displaying wait pages automatically | |
| |
| |
| |
A Single action for CRUD operations | |
| |
| |
Creating new categories with newCategory | |
| |
| |
Reading and updating with viewCategory and editCategory | |
| |
| |
Saving categories with saveCategory | |
| |
| |
Setting the parentCategory | |
| |
| |
| |
Summary | |
| |
| |
| |
WebWork architecture | |
| |
| |
Index | |