Free Sample
+ Collection

Learning Jakarta Struts 1.2: a concise and practical tutorial

Stephan Wiesner

A step-by-step introduction to building Struts web applications for Java developers
RRP $20.99
RRP $34.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781904811541
Paperback220 pages

About This Book

  • Learn to build Struts applications right away
  • Build an ecommerce store step-by-step using Struts
  • Well-structured and logical progression through the essentials

Who This Book Is For

This book is written for Java developers planning to develop web applications, who are new to Struts. It expects familiarity with Java, JSP and Servlets to a degree, although more obscure elements are explained.  It covers Struts 1.2.

Table of Contents

Chapter 1: Introduction to Struts
1.1 The Apache Jakarta Project
1.2 The Struts Project
1.3 The Struts Framework
1.4 Model Classes
1.5 Design Patterns
1.6 The Model View Controller (MVC)
1.7 MVC versus Model 2
1.8 Controller Component: ActionServlet
1.9 Design Guidelines for Action Classes
1.10 Reflection, Introspection, and DynaBeans
1.11 Session
1.12 Business Logic
1.13 Threads
1.14 Expandability
1.15 Debugging Struts Applications
1.16 Some Experiences
Chapter 2: Hello Struts
2.1 Tomcat Server Installation
2.2 Installation of Struts
2.3 A Simple Page
2.4 Internationalization with Struts
Chapter 3: The Struts Shop
3.1 Why a Bookstore
3.2 Iterations
3.3 Elements of the Shop
3.4 Installing MySQL
3.5 Tables
Chapter 4: Internationalization and Taglibs
4.1 The Structure for the Shop
4.2 Internationalization
4.3 The Welcome Page for the Shop
4.4 Custom Actions
4.5 struts-bean.tld
Chapter 5: Logging and Configuration
5.1 Configuration
5.2 Simple Logging
5.3 Logging Solutions
5.4 JDK Logging
5.5 Reading Configuration Settings
5.6 Logging with Log4J
5.7 Jakarta Commons Logging
5.8 Deciding What to Log
Chapter 6: Forms
6.1 Preparation
6.2 Struts Form Beans
6.3 Database
Chapter 7: Logic
7.1 Value Comparison
7.2 Substring Matching
7.3 Redirection
7.4 Collection Utilities
7.5 Sorting Tags
Chapter 8: Exceptions
8.1 Tomcat Error Pages
8.2 Custom Exceptions
8.3 Exception Handling
8.4 ActionErrors
Chapter 9: Controller and Templates
9.1 Consistent Layout without Struts
9.2 Central Controller with Struts
9.3 Consistent Layout with Struts Tiles
Chapter 10: Putting It All Together
10.1 Authorization
10.2 BookCatalog
10.3 Price Information
10.4 The Shopping Cart
Exercise 4
10.5 Using the Shopping Cart
10.6 Placing Orders
Chapter 11: Struts Validator and Plug-In Classes
11.1 Verifying User Input with the Struts Validator
11.2 Plug-In Classes
Chapter 12: JSTL
12.1 Installation
12.2 Internationalization
12.3 Java Classes
12.4 Iteration
12.5 JSTL and Struts-EL
Chapter 13: Tools and Tricks
13.1 Code Conventions
13.2 The Struts Console
13.3 Struts in WSAD (Eclipse)
13.4 StrutsDoc and Ant
13.5 Display Tags
13.6 Workflow
13.7 Testing: HTTPUnit
13.8 Different Struts Functions
13.9 XSLT Configuration Overview
13.10 Extending ActionServlet

What You Will Learn

  • Understand the Model-View-Controller architecture and how it is implemented in Struts    
  • How to start building an application with Struts
  • How to produce well-crafted and robust applications using sound software engineering practices
  • How to build a complete application, in this case a web bookstore


In Detail

Jakarta Struts is an Open Source Java framework for developing web applications. By cleanly separating logic and presentation, Struts makes applications more manageable and maintainable.
Since its donation to the Apache Foundation  in 2001, Struts has been rapidly accepted as the leading Java web application framework, and community support and development is well established.

Struts-based web sites are built from the ground up to be easily modifiable and maintainable, and internationalization and flexibility of design are deeply rooted. Struts uses the Model-View-Controller design pattern to enforce a strict separation between processing logic and presentation logic, and enables efficient object re-use.

The book is written as a structured tutorial, with each chapter building on the last. The book begins by introducing the architecture of a Struts application in terms of the Model-View-Controller pattern. Having explained how to install Jakarta and Struts, the book then goes straight into an initial implementation of the book store. The well structured code of the book store application is explained and related simply to the architectural issues.

Custom Actions, internationalization and the possibilities offered by Taglibs are covered early to illustrate the power and flexibility inherent in the framework. The bookstore application is then enhanced in functionality and quality through the addition of logging and configuration data, and well-crafted forms. At each stage of enhancement, the design issues are laid out succinctly, then the practical implementation explained clearly. This combination of theory and practical example lays a solid understanding of both the principles and the practice of building Struts applications.


Read More