The Jakarta Struts Framework is a popular open source platform for building web applications from top to bottom with Java. While this popularity has led to a wealth of online and in-print documentation, developers still find themselves faced with a number of common tasks that are not clearly and succinctly explained.In these situations, programmers can now turn to the Jakarta Struts Cookbook an amazing collection of code solutions to common--and uncommon--problems encountered when working with the Struts Framework. Among many other recipes, this book explains how to:
display data in complex HTML tables
define static and dynamic action forms
validate data and respond to errors
use Logging, Validation, and Exception Handling
integrate Struts with persistence frameworks like Hibernate and iBATIS
This look-up reference is just what today's time-pressed developers need. With solutions to real-world problems just a few page flips away, information is instantly available. And while the book's solutions focus on getting to the point, each recipe's discussion section imparts valuable concept and insight from a Struts veteran.The Jakarta Struts Cookbook is perfect for independent developers, large development teams, and everyone in between who wishes to use the Struts Framework to its fullest potential. Plus, it s completely up-to-date with the latest versions of Framework, so readers can be sure the information is viable.
Chapter 1 Getting Started: Enabling Struts Development
Deploying the Struts Example Application
Migrating from Struts 1.0 to Struts 1.1
Upgrading from Struts 1.1 to Struts 1.2
Converting JSP Applications to Struts
Managing Struts Configuration Files
Using Ant to Build and Deploy
Generating Struts Configuration Files Using XDoclet
Chapter 2 Configuring Struts Applications
Using Plug-ins for Application Initialization
Eliminating Tag Library Declarations
Using Constants on JSPs
Using Multiple Struts Configuration Files
Factoring Your Application into Modules
Using Multiple Resource Bundles
Accessing Message Resources from a Database
Selectively Disabling Actions
Chapter 3 User Interface
Using the Struts-EL Tags
Displaying Indexed Properties
Using Indexed Properties on Forms
Using Indexed Properties in a JSTL Loop
Submitting a Form from an Image
Generating Dynamic Select List Options
Filtering Text Input
Generating a Set of Related Radio Buttons
Handling Unchecked Checkboxes
Handling Date Input Fields
Setting Tab Order
Adding Request Parameters to a Link
Defeating Browser Caching
Chapter 4 Tables, Sorting, and Grouping
Creating a Horizontal Bar Chart
Creating a Vertical Bar Chart
Alternating Table Row Colors
Sorting HTML Tables
Using the Display Tag Library
Chapter 5 Processing Forms
Creating Dynamic Action Forms
Setting DynaActionForm Initial Values
Using a List-Backed Form Property
Using a Map-Backed Form Property
Lazy Dynamic Action Forms
Populating Value Objects from ActionForms
Automatically Creating ActionForms
Chapter 6 Leveraging Actions
Creating a Base Action
Returning the HTTP Response
Writing Thread-Safe Actions
Including the Response from a Servlet or JSP
Changing the Current Module
Managing Related Operations from a Central Action
Submitting a Form from Localized Form Controls
Dispatching to Related Operations with Action Mappings
Chapter 7 Execution Control
Performing Tasks at Application Startup
Tracking Client Sessions
Monitoring User Logins
Forwarding Users to Alternate Destinations
Forwarding Users to a Module
Creating a Wizard-Style Page Flow
Determining the Action Based on User Input
Using Wildcards in Action Paths
Preventing Double Form Submissions
Allowing Users to Upload Files
Displaying a File from the Server
Chapter 8 Input Validation
Reusing Validator Attribute Values
Validating Using Regular Expressions
Validating Dependent Fields in Struts 1.1
Validating Dependent Fields in Struts 1.2
Validating an Indexed Property
Validating Field Equality with a Custom Validator
Validating Field Equality in Struts 1.2
Validating Two or More Choices
Adding a Custom Validation to a Validator Form
Validating a Wizard Form
Localizing Validation Rules
Chapter 9 Exception and Error Handling
Simplifying Exception Processing in an Action
Custom Processing for Declared Exceptions
Using Exception Error Codes
Using a Global Error Page
Reporting Errors and Messages from an Action
Formatting Error Messages
Chapter 10 Connecting to the Data
Accessing JDBC Data Sources from an Action
Displaying Relational Data
Mapping SQL Data to Java Objects
Integrating Struts with Hibernate
Decoupling Your Application from External Services
Integrating Spring with Struts
Loading XML Data into Your Application
Refreshing Application Data
Chapter 11 Security
Securing Actions Using a Base Action
Checking for User Login on Any Struts Reques t
Securing a JSP Page
Restricting Actions by Role
Implementing "Remember Me" Logins
Ensuring Security Across Your Entire Application
Allowing a User to Log in Automatically
Limiting Access for Specific URLs by Role
Letting the Container Manage Security
Mixing Application-Managed and Container-Managed Security
Configuring Actions to Require SSL
Limiting the Size of Uploaded Files
Chapter 12 Internationalization
Detecting Browser Language Settings
Sharing Message Resources with JSTL
Using an Application-Wide Locale
Changing Locale on the Fly
Creating Localized Messages from an Action
Displaying Locale-Specific Text
Displaying Locale-Specific Images
Supporting Character Sets
Localizing Look and Feel
Chapter 13 Testing and Debugging
Deploying an Application Automatically
Configuring Struts Logging
Adding Logging to Your Own Classes
Enabling Remote Debugging
Troubleshooting JSP Pages
Testing Your Actions with Mock Objects
Testing Your Actions in the Container
Testing Application Functionality
Chapter 14 Tiles and Other Presentation Approaches
Bill Siggelkow is an independent consultant specializing in software design, development, and technical training. Bill is an active member of the Atlanta Struts User Group and frequently serves as a presenter for the group. With nearly 20 years of development experience, he has designed and developed systems for the manufacturing, energy marketing, e-commerce, and financial service industries.
Bill enjoys training and mentoring developers in the art of object-oriented programming and web development.
Bill lives in Atlanta, Georgia and has a degree in Industrial Engineering from Georgia Tech.
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Jakarta Struts Cookbook is a tragopan. Tragopans, or horned pheasants, are found along the Himalayas from Kashmir to central and southeastern China. Male tragopans are among the world's most spectacular birds because of their brilliant array of colors and spots, long crown feathers, and blue crests. In villages near the Great Himalayan National Park, the western tragopan has earned the local name Jujurana, or "the king of the birds." There, legend has it that when this pheasant was created, every bird in the universe donated a feather to give it color and unparalleled beauty. Female tragopans, on the other hand, are rather dull looking. Even breeders sometimes find it difficult to distinguish hens of one species from those of another.Tragopans feed on insects, leaves, sprouts, and seeds, and are thought to be monogamous. Although incubation is done entirely by the female, the male may assist in tending the chicks. Most tragopans are good breeders in captivity, adapting well to various cold-weather climates and becoming quite tame.There are five species of tragopans, four of which are in danger of extinction due to the destruction of their habitats. Unlike most fowl, tragopans live at very high elevations ranging from 925 to 3,650 meters. In the winter, they are typically found in the thickest parts of pine trees, but during mating season, they travel upward to the extreme limits of the forest. Finding a high branch, the male western tragopan establishes a territorial perch from which he calls at five-minute intervals. His call, which some have described as similar to that of a goose or young lamb, can be heard for more than a mile. Matt Hutchinson was the production editor for Jakarta Struts Cookbook. GEX, Inc. provided production services. Darren Kelly, Mary Anne Weeks Mayo, and Claire Cloutier provided quality control.Ellie Volckhausen designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the cover layout with Adobe InDesign CS using Adobe's ITC Garamond font.David Futato designed the interior layout, based on his own series design. This book was converted by Julie Hawks to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand MX and Adobe Photoshop CS. The tip and warning icons were drawn by Christopher Bing. This colophon was written by Lydia Onofrei.
This is a very thoughtful, well written book, that covers most of the issues that come up during programming with Struts. Although some recipes looked a bit like "fluff", 85% of the book was immediately relevant and useful.
Linux has grown tremendously in the server Operating System market, primarily due to the fact that it is stable and secure. But this growth has been restricted to the bigger corporates, with server farms and data centers, who have the resources to hire former Unix sysadmins and get high-priced consultants to manage migration of their existing IT infrastructure to a Linux-based one. Small and Medium Enterprises till now have generally remained Microsoft customers, because quite often, there is no specialized IT department in such organizations, and Microsoft's server products have GUI interfaces that make it easy for laypersons to set-up and administer services. Besides, Microsoft has tightly integrated services, like Active Directory and Exchange, which is a further incentive to use Microsoft server products.
However, the proliferation of security issues, stability issues and the high cost of user-licenses have forced quite a lot of the SMEs to explore the possibility of using Linux to replace most, if not all the Microsoft server software. IT consultants catering to the SME market are also facing queries from their clients regarding the hype surrounding Linux, and the possible advantages of switching to Linux. The book "Windows to Linux Migration Toolkit" is aimed at this SME segment that is exploring ways to cut costs by switching to Linux.
The book is divided into 11 chapters and 3 appendices, which cover almost all the major services used by SMEs today.
Chapter 1 deals with the planning the roadmap and, keeping its target audience in mind, introduces us to the migration roadmaps of two fictional SMEs : Acme Widgets Manufacturing Inc. and Ballystyx Global Semiconductor Engineering Inc. The authors show how to make an inventory of the servers in an enterprise, create current and post-migration infrastructure diagrams, functional requirements documents and a test plan. While IT consultants may be doing all of these and more for their clients, this chapter is more useful to those do-it-yourself people in small enterprises, who are not trained administrators, but are responsible for their organization's IT infrastructure nonetheless.
Chapter 2 covers DHCP, DNS and NTP (Network Time Synchronization Protocol). These are the easiest services to configure (well DNS isn't that easy) but are often critical to a network functioning properly. Complete configuration files are provided that serve as examples. Advanced topics like dynamic DNS update are also covered. However, I found the coverage of DNS itself to be a little short. While migration from Windows based DNS are explained, coverage of BIND configuration files and zone files is insufficient in my opinion.
Chapter 3 explains Directory Services. The chapter opens with a succinct introduction to LDAP and Directory Structure in general, explaining the concepts of Distinguished Names and Organizational Units in simple terms. Briefly explaining how users are organised into directories in Windows Active Directory, the chapter goes on to explain how to set up OpenLDAP to provide directory services (whit pages) in Linux.
Chapter 4 deals with Authentication Services and is closely associated with Chapter 3. The chapter first covers Windows and Linux authentication mechanisms including LDAP and NSS. Brief coverage of Pluggable Authentication Modules is also provided. The chapter also shows how to use the directory server that was configured in chapter 3 could be extended using Samba to support both Windows and Linux clients. Lots of examples from configuration files used by the fictional companies are given, including how to enable encryption of authentication data.
Chapter 5 ostensibly covers File Services, but hardly has any details on File Services. Most of the information for configuring File Services for Windows clients have been discussed in the previous chapter during the configuration of Samba. Instead this chapter discusses Linux filesystems and data backup tools. Some discussion of Access Control Lists is also provided in order to secure file shares.
Chapter 6 deals with Print Services. This chapter has a brief coverage of the print commands used in Linux. It also discusses setting up CUPS, configuring printers and sharing them with Samba (including how to configure Samba to allow clients to download printer drivers automatically from the server itself).
Email and Messaging services are covered in chapter 7. The authors describe the different pieces of a Linux Messaging System (the Mail Transfer Agent, Mail User Agent, etc.), explain the difference between mbox and maildir mail storage formats and provides the pros and cons of the various mail server software like sendmail, Postfix, Courier Suite and Exim. A section on choosing the most appropriate software for an organisation, helps the reader to decide. E.G. The authors state that since the Courier Suite includes all major components of a messaging system, including the Webmail, POP/IMAP and mailing list manager, it makes sense for small organizations like Acme Widgets to use the Courier Suite, as it provides an integrated suite. But larger organizations like Ballystyx may have more complex requirements, which calls for complex decision making process. The use of Email server component diagram helps to understand how the different pieces of software fit together. Spam and antivirus integration using spamassassin and clamav are discussed, along with migration of user data from Exchange.
Chapter 8 provides an overview of the different groupware and calendaring software available for Linux. A basic overview and list of features of the software discussed are listed. More detailed description and installation and configuration instructions for the software discussed would have been ideal, and will possibly be a welcome addition to the second edition.
Chapter 9 discusses Web Services using Apache. Configuration instructions are provided and some advanced topics like SSL/TLS, virtual hosting, .htaccess files, etc. are touched. Some discussion of mod_mono as a means of serving up ASP pages from Apache and migrating websites directly from IIS would have been an interesting addition. Another crucial addition would be a discussion of Content Management Systems.
Chapter 10, on Desktop Migration Roadmap, is probably one of the most important chapters in this book. The authors describe how to grade the users into different types such as kiosk users, knowledge workers, technical workers, etc. helps to isolate the applications needed for day to day work, by the users, and appropriately develop a migration path that minimizes disruption. Desktop asset lists, cataloging file formats and functional requirements specifications are used to estimate the costs of migrating to Linux and the associated cost savings of license fees, and pinpoint areas of possible disruptions during migration. Guidelines for training users on the new environment specify the process of making the migration as painless as possible for the users.
Chapter 11 is an extension of chapter 10, and mainly explores the alternatives to common office applications used on Windows. Lots of screenshots are provided to help people choose their favourite application. Desktop environments are covered along with the most common Linux applications. Products that enable Windows applications to run on Linux are also discussed. One of the most interesting parts of this chapter is the discussion on alternative desktop environments/window managers like XFCE, Busybox, Enlightenment, etc.
The appendices are worthy of being complete chapters unto themselves. Appendix A introduces the reader to Network Analysis, using tcpdump and Ethereal. The authors teach how to capture and analyze network data. Readers are taught how to detect patterns in the data, to catch packet sniffers and identify potential problems with network services. A brief description of the Carnivore system is also provided. Issues with network design are dealt with, and readers are taught the difference between a hub, a switch and a router. The pros and cons of each type of network set-up is explained, security threats assessed, and preventive measures described.
Appendix B deals with Intrusion Detection Systems. The authors provide a general idea of Network, Host-based and Distributed IDS networks with pictures to explain the concepts and provide a lot of theoretical knowledge about IDS. However discussion of how to install and configure IDS on Linux is left untouched. Basic Snort and Tripwire configuration would've been helpful to the readers, especially considering the target audience of the book. The question of recovering data from a server under attack using live CDs is barely touched upon. A book like Knoppix Hacks would be a perfect partner to this section, as it describes how to disinfect a server under virus attack, or to extract user information from the server.
Appendix C contains information on Nessus and Vulnerability Assessment tools. An outline of the assessment process is given, and screenshots are provided to give a fair idea of how to use Nessus to check for security vulnerabilities. Tips are provided to help identify services running on ports identified by Nessus, check for corresponding vulnerabilities and provide a report. Different approaches to automated vulnerability assessment procedure along with their advantages and disadvantages are discussed.
This book is perfect for Windows administrators to use as a reference for developing a migration plan to Linux, ranging in scope from the basic DHCP/DNS server functions to a complete Linux based IT infrastructure. Addition of a few more details and configuration details for topics like BIND, FreeRADIUS and Groupware functions, along with the security and audit tools would make this book an even more valuable addition to the book shelf of a Windows IT consultant.
One minor irritation was that there are quite a number of spelling mistakes in this book. Also, while the pictures were clear and the configuration files readable, however, complete configuration file listings would've been even more useful.
The CD contains scripts that help to extract user data from Microsoft servers and output them into a format that is suitable for entry into their Linux equivalents. All the scripts are under GPL. I have not managed to test the scripts, but first looks indicate that the scripts should be able to handle all configuration quirks of Microsoft servers.
I have not gone through the e-booklets available along with this book, so I'm unable to comment on them.