Skip to Main Content
Jakarta Struts Cookbook
book

Jakarta Struts Cookbook

by Bill Siggelkow
February 2005
Intermediate to advanced content levelIntermediate to advanced
528 pages
12h 53m
English
O'Reilly Media, Inc.
Content preview from Jakarta Struts Cookbook

Chapter 6. Leveraging Actions

Introduction

Actions control the flow of data and navigation in a Struts application. Each Action acts like a decision point in a flow chart. It's the place where you can decide what data to create, what data to save, and where to send users based on their input. A Struts application doesn't require that every request be routed through an Action, but doing so gives you a level of control that will allow your application to adapt as requirements and new features are changed and added.

Do you feel like your application is exploding with hundreds of custom Actions? If it is, you aren't alone. This condition can be acceptable, but you may not be leveraging Struts Actions to their full extent. Using the recipes in this chapter will enable you to get more reuse from your Actions and reduce the number of custom classes that you have to maintain.

A number of the recipes in this chapter utilize Action subclasses included with Struts. These pre-built actions are found in the org.apache.struts.actions package. Some of these actions are designed to be extended, and others are used as is. The DispatchAction and its provided subclasses, LookupDispatchAction and MappingDispatchAction, fall into this first category. These actions reduce the amount of code you have to write by replacing multiple related Actions with a single Action that supports multiple operations.

You use two other pre-built actions, ForwardAction and IncludeAction, directly—no subclassing required. These ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Jakarta Struts

Programming Jakarta Struts

Chuck Cavaness
Beginning Spring Framework 2

Beginning Spring Framework 2

Bruce Snyder, Sing Li, Anne Horton, Thomas Van de Velde, Naveen Balani, Christian Dupuis
Java Cookbook

Java Cookbook

Ian F. Darwin
Struts 2 in Action

Struts 2 in Action

J. Scott Stanlick, Chad Michael Davis, Donald J. Brown

Publisher Resources

ISBN: 059600771XSupplemental ContentErrata Page