Gift Guide

Struts Recipes


This strategy guide helps developers to solve Struts problems and highlights the best practices to ensure that applications are secure, robust, and maintainable. Detailed code listings are designed to save developers time and money by jumping straight to the answer. In addition to a solution, each recipe clearly defines the business problem, provides the necessary background to understand the recipe, and discusses the implications of using the solution, and recipes reveal every layer of the model view controller ...

See more details below
$33.26 price
(Save 26%)$44.95 List Price
Other sellers (Paperback)
  • All (18) from $1.99   
  • New (6) from $8.50   
  • Used (12) from $1.99   
Sending request ...


This strategy guide helps developers to solve Struts problems and highlights the best practices to ensure that applications are secure, robust, and maintainable. Detailed code listings are designed to save developers time and money by jumping straight to the answer. In addition to a solution, each recipe clearly defines the business problem, provides the necessary background to understand the recipe, and discusses the implications of using the solution, and recipes reveal every layer of the model view controller (2) design pattern. Detailed descriptions are also provided for using basic and extended tag libraries (including Struts-Layout), using Ant with Struts, validation, security, and complex problem solving. All of the recipes contained in the book have been used and implemented in enterprise level applications so that they can be used with confidence.
Recipes include:
* How to automate your projects using Ant builds
* Cross validate your forms with a pluggable validator
* Unit testing your apps for function, performance, and coverage
* Make your applications secure
* How to effectively deal with exceptions
* Generate alternate view using PDF and XSL
* Refine your UI with Struts-Layout
* How do design a layered Struts application
* Understand the ins and out of the Tiles Controller
* Use a database in your message-resource
* Integration with Hibernate
* Use a Struts plug-in to cache resources
*Extend the iterate tag to alternate row colors
* Use the SSL extension library
* Learn about the undocumented Validator constants
* Create a wizard
.... and much more!

Read More Show Less

Product Details

  • ISBN-13: 9781932394245
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/28/2004
  • Pages: 489
  • Product dimensions: 7.36 (w) x 9.44 (h) x 1.00 (d)

Meet the Author

George Franciscus is an independent consultant at, providing technical and management consulting services. He has experience in a diverse range of technologies, including Java, J2EE, Domino, relational databases, and mainframe technologies and is the coauthor of Struts In Action. He lives in Toronto, Ontario. Danilo Gurovich is the manager of web development at He has designed and implemented Struts-based applications in high traffic commerce, enterprise application integration monitoring and controlling, and business process management. His non-Java experience extends to GUI Design, Human Factors, and Graphics. He lives in Northridge, California.

Gurovich is a Manager of Web Engineering at an eCommerce Company.

Read More Show Less

Table of Contents

Preface xix
Acknowledgments xx
About this book xxii
1 Basic recipes 1
But what is Struts? 2
What Struts isn't 3
A note about our favorite Ant 3
The developer's environment 4
Chapter 1, in brief 5
1.1 Use Ant to automatically build a Struts project 6
1.2 Default your application to an ActionForward 14
1.3 What is "jsessionid" and why do I need it? 16
1.4 Using modules for large projects 19
1.5 Specifying a resource property file in a configuration 25
1.6 Multiple message-resources in an application 27
1.7 Using the bundle attribute in Struts' custom tags 28
1.8 Manage constants throughout your application 32
1.9 Use [left angle bracket]html:base/[right angle bracket] for solid page references 35
1.10 Associating Cascading Style Sheets with Struts JSP pages 37
1.11 Implementing DynaActionForms 38
2 Forms and form elements 42
2.1 Display errors and messages 44
2.2 Display errors next to a field 50
2.3 Create a custom message queue 53
2.4 Display errors and messages in groups 57
2.5 Dynamically insert data inside a message 62
2.6 Use message-resources property file from inside an Action 69
2.7 Create a wizard 73
2.8 Alternate row colors 80
2.9 Upload a file 89
3 Struts tag libraries 96
Using Struts tag libraries to promote good MVC practice 97
What is a tag library? 99
What tags do we discuss in this chapter? 102
3.1 Using [left angle bracket]html:link/[right angle bracket] to increase your application's maintainability 105
3.2 Rendering images mapped from a properties file using [left angle bracket]html:img/[right angle bracket] 109
3.3 Encoding information with a [left angle bracket]bean:write/[right angle bracket] tag 113
3.4 Using [left angle bracket]bean:define/[right angle bracket] to expose information to your pages 116
3.5 Use [left angle bracket]bean:include/[right angle bracket] for the simple server-side includes 122
3.6 Using [left angle bracket]logic:present/[right angle bracket] tags to determine page content 126
3.7 Debugging your GUI with the [left angle bracket]logic:present/[right angle bracket] tag 130
3.8 Using the [left angle bracket]logic:equal/[right angle bracket] tag for view decisions 134
3.9 Using [left angle bracket]bean:resource/[right angle bracket] to expose the struts.config.xml to your view 138
3.10 Using [left angle bracket]html:rewrite/[right angle bracket] to resolve URLs 147
3.11 Cleaning up session-scope attributes 153
3.12 Creating a basic Struts Tiles page 158
3.13 Using Tiles with XML Definitions 164
4 The Struts-Layout tag library 170
Le Roi du Pot-au-feu 171
Pot-au-feu 171
What do layout tags do? 172
4.1 Configuring your application to use Struts-Layout tags 175
4.2 Creating a simple table with Struts-Layout tags 178
4.3 Creating a multicolumn dynamic table with Struts-Layout tags 182
4.4 Using Struts-Layout panels 187
4.5 Adding skins to your project with Struts-Layout 193
4.6 Creating a table with selectable rows using Struts-Layout 201
4.7 Creating a tree navigation scheme with Struts-Layout 206
4.8 Creating "bread crumb trails" with Struts-Layout 217
4.9 Creating tabbed panes with Struts-Layout 224
4.10 Implementing a "pager" with Struts-Layout 233
5 Validation within the Struts framework 242
5.1 Use an ActionForm to validate 244
5.2 Struts Validator files explained (server-side) 247
5.3 Struts Validator files explained (client-side) 252
5.4 Use declarative exception handling 256
5.5 Aggregate exceptions 261
5.6 Tailor a form for a DispatchAction 268
5.7 Use Validator constants 276
5.8 Validation in a wizard 282
5.9 Create a pluggable validator for cross-form validation 287
6 Internationalization 294
The "national language" of the United States 295
6.1 Set locale dynamically 296
6.2 Internationalize your text 298
6.3 Internationalize your images 302
6.4 Create a locale-sensitive ActionForward 305
6.5 Internationalize your tiles 309
6.6 Internationalize validation 312
7 Logging in, security, and guarding 317
7.1 Tomcat domain authentication and Struts 320
7.2 Handling log out 326
7.3 Switch to SSL and back again 329
7.4 Secure an action mapping using the container 336
7.5 Customized action mapping security 338
7.6 Protect areas on a page 343
7.7 Protect fields 346
8 Advanced recipes 348
Case study-a modern luxury hotel 349
Let's revisit our B2C web application 351
8.1 Caching using a Struts plug-in 352
8.2 Use the Tiles controller 358
8.3 Generate a response with XSL 365
8.4 Generate a PDF 371
8.5 Hibernate and Struts 377
8.6 Layering applications 392
8.7 Enforce navigation 406
8.8 Use a database to store your message-resources properties 417
9 Testing 424
9.1 Testing outside the container with StrutsTestCase 426
9.2 In-container testing with StrutsTestCase and Cactus 437
9.3 Testing DynaActionForm with StrutsTestCase 444
9.4 Testing modules 449
9.5 Performance testing Struts applications 454
9.6 Testing coverage 462
References 469
Index 473
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)