Manning Logo
Home | Ordering Info | Shopping Cart | Manage My Account | Login
Attention customers: online shopping is now available exclusively through our main website: http://www.manning.com. Thank you.
Struts Recipes

Inside the book

About this Book Struts Best Practices Sample Chapters Table of Contents Index Book Reviews Source Code Author Online

Manning Blog

Why small is sweet?

Author Blogs

Dave Crane more...

Author Calendar

Upcoming Events

Catalog

Java .NET Perl XML All by Subject All by Title

About...

Manning Contact Us Ordering FAQs ebooks Covers Sandbox Forums Distributors Manning Early Access Program (MEAP) Affiliate Program Academia/Publicity User Group Program Press Releases Jobs

Manning Publications Co.
209 Bruce Park Avenue
Greenwich, CT 06830

Struts Recipes
George Franciscus and Danilo Gurovich

2004 | 520 pages
ISBN: 1932394249
$44.95 Softbound print book  

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 <html:base/> 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 <html:link/> to increase your application’s maintainability 105
3.2 Rendering images mapped from a properties file using <html:img/> 109
3.3 Encoding information with a <bean:write/> tag 113
3.4 Using <bean:define/> to expose information to your pages 116
3.5 Use <bean:include/> for the simple server-side includes 122
3.6 Using <logic:present/> tags to determine page content 126
3.7 Debugging your GUI with the <logic:present/> tag 130
3.8 Using the <logic:equal/> tag for view decisions 134
3.9 Using <bean:resource/> to expose the struts.config.xml to your view 138
3.10 Using <html:rewrite/> 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

DESCRIPTION

This book is for developers and architects with real Struts work to do. It offers a broad collection of practical solutions complete with detailed code listings that will save you time and money. Each recipe clearly defines the problem it solves, gives you the background you need, and discusses the practical implications of adopting the solution. Many recipes point out little-known "gotchas" which will save you from needless grief. This book introduces you to Struts best practices so you can make your applications secure, robust, and maintainable.

Techniques presented in this book have gone through the trial by fire of real-life enterprise development and deployment you can rely on them with confidence.

A Sampling of What's Inside

  • How to automate your projects using Ant builds
  • Cross validate your forms with a pluggable validator
  • Unit test your app for function, performance, and coverage
  • Make your application secure
  • How to deal with exceptions
  • Generate alternate views using PDF and XSL
  • Refine your UI with Struts-Layout
  • How to design a layered Struts application
  • Understand the ins and outs of the Tiles Controller
  • Use a DB in your message-resource
  • Integration with Hibernate

ABOUT THE AUTHORS...

George Franciscus is a J2EE consultant and Struts authority. He is a coauthor of Manning's Struts in Action.

Danilo Gurovich is a Manager of Web Engineering at an eCommerce Company. He has designed eCommerce and ERP/EAI Struts applications, and led teams who built them.

Home | Catalog | Privacy Policy | About Manning

© 2003-2006 Manning Publications Co.