Jakarta Struts Cookbook
Table of Contents
Copyright
Preface
Audience
Scope and Organization
Assumptions This Book Makes
Conventions Used in This Book
Using Code Examples
Comments and Questions
Safari Enabled
Acknowledgments
Chapter 1.聽 Getting Started: Enabling Struts Development
Introduction
Recipe聽1.1.聽Downloading Struts
Recipe聽1.2.聽Deploying the Struts Example Application
Recipe聽1.3.聽Migrating from Struts 1.0 to Struts 1.1
Recipe聽1.4.聽Upgrading from Struts 1.1 to Struts 1.2
Recipe聽1.5.聽Converting JSP Applications to Struts
Recipe聽1.6.聽Managing Struts Configuration Files
Recipe聽1.7.聽Using Ant to Build and Deploy
Recipe聽1.8.聽Generating Struts Configuration Files Using XDoclet
Chapter 2.聽 Configuring Struts Applications
Introduction
Recipe聽2.1.聽Using Plug-ins for Application Initialization
Recipe聽2.2.聽Eliminating Tag Library Declarations
Recipe聽2.3.聽Using Constants on JSPs
Recipe聽2.4.聽Using Multiple Struts Configuration Files
Recipe聽2.5.聽Factoring Your Application into Modules
Recipe聽2.6.聽Using Multiple Resource Bundles
Recipe聽2.7.聽Accessing Message Resources from a Database
Recipe聽2.8.聽Selectively Disabling Actions
Chapter 3.聽 User Interface
Introduction
Recipe聽3.1.聽Using JSTL
Recipe聽3.2.聽Using the Struts-EL Tags
Recipe聽3.3.聽Displaying Indexed Properties
Recipe聽3.4.聽Using Indexed Properties on Forms
Recipe聽3.5.聽Using Indexed Properties in a JSTL Loop
Recipe聽3.6.聽Submitting a Form from an Image
Recipe聽3.7.聽Generating JavaScript on the Fly
Recipe聽3.8.聽Dynamically Changing Select Options Using JavaScript
Recipe聽3.9.聽Generating Dynamic Select List Options
Recipe聽3.10.聽Filtering Text Input
Recipe聽3.11.聽Generating a Set of Related Radio Buttons
Recipe聽3.12.聽Handling Unchecked Checkboxes
Recipe聽3.13.聽Handling Date Input Fields
Recipe聽3.14.聽Setting Tab Order
Recipe聽3.15.聽Generating URLs
Recipe聽3.16.聽Adding Request Parameters to a Link
Recipe聽3.17.聽Using Frames
Recipe聽3.18.聽Defeating Browser Caching
Chapter 4.聽 Tables, Sorting, and Grouping
Introduction
Recipe聽4.1.聽Creating a Horizontal Bar Chart
Recipe聽4.2.聽Creating a Vertical Bar Chart
Recipe聽4.3.聽Alternating Table Row Colors
Recipe聽4.4.聽Sorting HTML Tables
Recipe聽4.5.聽Paging Tables
Recipe聽4.6.聽Using the Display Tag Library
Chapter 5.聽 Processing Forms
Introduction
Recipe聽5.1.聽Creating Dynamic Action Forms
Recipe聽5.2.聽Setting DynaActionForm Initial Values
Recipe聽5.3.聽Using a List-Backed Form Property
Recipe聽5.4.聽Using a Map-Backed Form Property
Recipe聽5.5.聽Lazy Dynamic Action Forms
Recipe聽5.6.聽Populating Value Objects from ActionForms
Recipe聽5.7.聽Automatically Creating ActionForms
Chapter 6.聽 Leveraging Actions
Introduction
Recipe聽6.1.聽Creating a Base Action
Recipe聽6.2.聽Relaying Actions
Recipe聽6.3.聽Returning the HTTP Response
Recipe聽6.4.聽Writing Thread-Safe Actions
Recipe聽6.5.聽Forwarding Requests
Recipe聽6.6.聽Including the Response from a Servlet or JSP
Recipe聽6.7.聽Changing the Current Module
Recipe聽6.8.聽Managing Related Operations from a Central Action
Recipe聽6.9.聽Submitting a Form from Localized Form Controls
Recipe聽6.10.聽Dispatching to Related Operations with Action Mappings
Chapter 7.聽 Execution Control
Introduction
Recipe聽7.1.聽Performing Tasks at Application Startup
Recipe聽7.2.聽Tracking Client Sessions
Recipe聽7.3.聽Monitoring User Logins
Recipe聽7.4.聽Forwarding Users to Alternate Destinations
Recipe聽7.5.聽Forwarding Users to a Module
Recipe聽7.6.聽Creating a Wizard-Style Page Flow
Recipe聽7.7.聽Determining the Action Based on User Input
Recipe聽7.8.聽Using Wildcards in Action Paths
Recipe聽7.9.聽Preventing Double Form Submissions
Recipe聽7.10.聽Allowing Users to Upload Files
Recipe聽7.11.聽Displaying a File from the Server
Chapter 8.聽 Input Validation
Introduction
Recipe聽8.1.聽Reusing Validator Attribute Values
Recipe聽8.2.聽Validating Using Regular Expressions
Recipe聽8.3.聽Validating Dependent Fields in Struts 1.1
Recipe聽8.4.聽Validating Dependent Fields in Struts 1.2
Recipe聽8.5.聽Validating an Indexed Property
Recipe聽8.6.聽Validating Dates
Recipe聽8.7.聽Validating Field Equality with a Custom Validator
Recipe聽8.8.聽Validating Field Equality in Struts 1.2
Recipe聽8.9.聽Validating Two or More Choices
Recipe聽8.10.聽Adding a Custom Validation to a Validator Form
Recipe聽8.11.聽Validating a Wizard Form
Recipe聽8.12.聽Localizing Validation Rules
Chapter 9.聽 Exception and Error Handling
Introduction
Recipe聽9.1.聽Simplifying Exception Processing in an Action
Recipe聽9.2.聽Custom Processing for Declared Exceptions
Recipe聽9.3.聽Using Exception Error Codes
Recipe聽9.4.聽Using a Global Error Page
Recipe聽9.5.聽Reporting Errors and Messages from an Action
Recipe聽9.6.聽Formatting Error Messages
Chapter 10.聽 Connecting to the Data
Introduction
Recipe聽10.1.聽Accessing JDBC Data Sources from an Action
Recipe聽10.2.聽Displaying Relational Data
Recipe聽10.3.聽Mapping SQL Data to Java Objects
Recipe聽10.4.聽Integrating Struts with Hibernate
Recipe聽10.5.聽Decoupling Your Application from External Services
Recipe聽10.6.聽Integrating Spring with Struts
Recipe聽10.7.聽Loading XML Data into Your Application
Recipe聽10.8.聽Refreshing Application Data
Chapter 11.聽 Security
Introduction
Recipe聽11.1.聽Securing Actions Using a Base Action
Recipe聽11.2.聽Checking for User Login on Any Struts Reques t
Recipe聽11.3.聽Securing a JSP Page
Recipe聽11.4.聽Restricting Actions by Role
Recipe聽11.5.聽Implementing
Recipe聽11.6.聽Ensuring Security Across Your Entire Application
Recipe聽11.7.聽Allowing a User to Log in Automatically
Recipe聽11.8.聽Limiting Access for Specific URLs by Role
Recipe聽11.9.聽Letting the Container Manage Security
Recipe聽11.10.聽Mixing Application-Managed and Container-Managed Security
Recipe聽11.11.聽Configuring Actions to Require SSL
Recipe聽11.12.聽Limiting the Size of Uploaded Files
Chapter 12.聽 Internationalization
Introduction
Recipe聽12.1.聽Detecting Browser Language Settings
Recipe聽12.2.聽Sharing Message Resources with JSTL
Recipe聽12.3.聽Using an Application-Wide Locale
Recipe聽12.4.聽Changing Locale on the Fly
Recipe聽12.5.聽Creating Localized Messages from an Action
Recipe聽12.6.聽Displaying Locale-Specific Text
Recipe聽12.7.聽Displaying Locale-Specific Images
Recipe聽12.8.聽Supporting Character Sets
Recipe聽12.9.聽Localizing Look and Feel
Chapter 13.聽 Testing and Debugging
Introduction
Recipe聽13.1.聽Deploying an Application Automatically
Recipe聽13.2.聽Configuring Struts Logging
Recipe聽13.3.聽Adding Logging to Your Own Classes
Recipe聽13.4.聽Enabling Remote Debugging
Recipe聽13.5.聽Troubleshooting JSP Pages
Recipe聽13.6.聽Testing Your Actions with Mock Objects
Recipe聽13.7.聽Testing Your Actions in the Container
Recipe聽13.8.聽Testing Application Functionality
Chapter 14.聽 Tiles and Other Presentation Approaches
Introduction
Recipe聽14.1.聽Reusing a Common Page Layout with Tiles
Recipe聽14.2.聽Extending Tile Definitions
Recipe聽14.3.聽Displaying Tiles Using a Struts Forward
Recipe聽14.4.聽Creating Tabbed Panes
Recipe聽14.5.聽Using Tiles for I18N
Recipe聽14.6.聽Using Tiles in a Modular Application
Recipe聽14.7.聽Reusing a Common Page Layout with SiteMesh
Recipe聽14.8.聽Integrating JavaServer Faces with Struts
Recipe聽14.9.聽Integrating Struts and Velocity
Recipe聽14.10.聽Integrating Struts and XSLT
Colophon
Index
SYMBOL
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
R
S
T
U
V
W
X
Z