Scope and Organization


Shortly after I started on the real meat of the recipes I ran into a dilemma. Do I focus on only those issues related directly to Struts? More importantly, should the Solutions only use technology available with Struts? I quickly realized that considering solutions that used Struts exclusively would be a disservice to the developer. Struts overlays and intersects with many other technologies from HTML to JSP to XML. I wanted the recipes to reflect this synergy as well.

Within the pages of this book you will find solutions that use tools and technologies not provided by Struts, such as the use of the JSTL. This ability to plug-and-play using external software tools and libraries demonstrates Struts's flexibility and robustness. If you prefer to use JSTL over the Struts tags, then do it! Struts integrates just fine with JSTL, and I present many recipes that help you along. If you need to display tabular data with sorting and paging, you can roll your own solution or use a third-party library. This book will show you how to use both approaches.

Almost all of the solutions, which use third-party libraries, leverage open source software. Open source software has really come of age in the last few years. Though open source solutions are traditionally linked with bleeding-edge dot-com'ers, it's been my experience that corporate IT shops are now seriously considering and using open source technology alongside traditional vendor offerings.

This environment empowers all developers. Through these freely available tools and libraries, you can easily set upon your desktop computer no lessan environment capable of developing and testing enterprise-caliber J2EE applications. With the proliferation of high-speed Internet access, developing Java-based web applications has never been easier.

Sounds easy, right? If you're like me, you are overwhelmed with so many choices. It's hard to choose the right solution for the problem at hand. The recipes in this book help with this problem. I give you solutions that let you judge whether a particular tool or technique is well-suited to your situation. Instead of spending hours researching possible solutions, in 10 minutes you can solve your problem. Here's the breakdown, chapter by chapter:


Chapter 1, Getting Started: Enabling Struts Development

This first chapter describes how to download Struts and deploy the sample applications. I'll show you what's involved in upgrading your application to the latest Struts Version. I will cover some advanced topics, presenting ways you can be more productive as a developer using tools like Ant and XDoclet.


Chapter 2, Configuring Struts Applications

Chapter 2 presents recipes illustrating the myriad of ways you can configure, organize, initialize, and architect your Struts application to suit your needs. I will show you how to separate your development into manageable groups using multiple configuration files. You will see how to set up Struts plug-ins, modules, and message resources.


Chapter 3, User Interface

Figuring out how to present data can be just as important as how to acquire data in the first place. This chapter delves into the world of the Struts tag libraries and focuses on creating robust pages that can adapt as the underlying model changes. Topics in this chapter include using indexed properties, incorporating the JSTL, working with date fields, and taking advantage of dynamically generated JavaScript.


Chapter 4, Tables, Sorting, and Grouping

This chapter is fairly straightforward and focuses primarily on using HTML tables for display of tabular data.


Chapter 5, Processing Forms

Struts uses action forms to move data from the view to the controller and back. Chapter 5 shows you how to be productive with action forms including the use of dynamic action forms. I'll look at some different ways of mapping action forms to business objects.


Chapter 6, Leveraging Actions

Struts actions represent the integration point between the view and the model. Actions hook into your applications business logic and drive functionality. In Chapter 6, you'll see how to get the most out of your actions. You'll learn how to take advantage of Struts pre-defined actions, simplifying and improving your application.


Chapter 7, Execution Control

This chapter addresses problems related to managing your application's life cycle and handling different navigation requirements. The solutions show you how to use Struts plug-ins, servlet context, and session listeners. The chapter covers creating wizard-style interfaces, preventing double-form submission, and handling file uploads.


Chapter 8, Input Validation

A good web application verifies that entered data is valid before it sends that data to the business layer. Chapter 8 shows you how you can build validation into your application using the Struts Validator. Even when your data is valid, your application may still need to handle unexpected errors.


Chapter 9, Exception and Error Handling

Chapter 9 shows you how you can handle errors and exceptional conditions in a predictable manner.


Chapter 10, Connecting to the Data

Struts doesn't provide the model for your application; rather, it provides hooks that allow you to integrate your model with the controller. I show you a number of popular ways that you can integrate Struts to the model in this chapter. In particular, I'll explore integrating Struts with the persistent frameworks like iBATIS and Hibernate. I'll show you some useful patterns for abstracting data access behind service interfaces. I'll show you how you can integrate Struts with the Spring inversion-of-control (IOC) framework.


Chapter 11, Security

Most web applications have some requirements for security. These can vary widely from simple password authentication to complex integration with back-end directory services. In this chapter, I consider those security issues that are particularly applicable at the web tier. I'll show you various techniques for securing your application from simple base Actions to container-managed security and beyond.


Chapter 12, Internationalization

From the outset, the ability to localize a web application for a particular spoken language and geographic region has been a core feature of Struts. In Chapter 12, I'll show you how to maximize those features to address problems related to supporting multiple languages.


Chapter 13, Testing and Debugging

If you can't test your application, you are bound to become overwhelmed with defects when you release your application to production. This chapter shows you a number of techniques for solving the tricky issues of testing and debugging J2EE applications. With the recipes in this chapter, you will be well-equipped to find defects before your application gets to production or the QA team.


Chapter 14, Tiles and Other Presentation Approaches

Struts was designed from the beginning with extensibility and customization as first-class features. This final chapter shows how you can leverage this ability with the presentation side of your application. This chapter shows you how to get started using Tiles. I'll investigate an alternative approach to layout-management using SiteMesh. This chapter closes with recipes that show you how to integrate Struts with alternative presentation approaches such as JavaServer Faces, Velocity, and XSLT.

It's not possible to cover every problem that you may encounter in development of a Struts application. Keep in mind that the solution is not necessarily meant to be taken in isolation. In fact, you may find that your problem is solved by combining several solutions together. If you still can't resolve your problem, please let me know. More importantly, take your problem to the struts-user mailing; the Struts community is always willing to help.



    Jakarta Struts Cookbook
    Jakarta Struts Cookbook
    ISBN: 059600771X
    EAN: 2147483647
    Year: 2005
    Pages: 200

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net