0%

Book Description

Learn to build applications with Jakarta Struts, the most popular JSP development framework. Struts Kick Start is a "hands-on" book filled with sample applications and code snippets you can reuse, and in-depth coverage of new features in Struts 1.1. If you are looking for a practical book that "shows you how to do it", then Struts Kick Start is for you. Plus, it's the first Struts book with detailed examples of the major Struts tags.

The book begins with a discussion of Struts and its Model-View-Controller (MVC) architecture. The authors' then demonstrate Struts' power through the development of a non-trivial sample application - covering all the Struts components in a "how to use them" approach. You'll also see the Struts Tag Library in action - use tags for HTML, javabeans, logical operations and more. You'll learn to use Struts with JBoss for EJB's, with Apache Axis to publish and use Web Services, and with JUnit for testing and debugging. The authors work with the latest Struts 1.1 features including DynaForms, Tiles and the Validator.

The book includes a CD-ROM containing the tools discussed in the book: Struts 1.1 beta 2, Java 2 Standard Edition, JBoss 3.0.3, MySQL 3.23, XDoclet, Torque, Tomcat, Ant, Axis, Cactus, and JUnit. Plus, it comes with an electronic, fully searchable version of the book.

From the Inside Cover: Thoroughly covers the essential features of Struts in a clear and readable style.

Struts Kick Start is a solid starting point for learning how to develop web applications using Struts. The authors start you off by reviewing the foundational technologies on which Struts is based, and immediately get into the sorts of practical "how to" information and examples that get you up to speed quickly.

Notable features that I really appreciated include the coverage on integration with other technologies (such as EJBs and web services), using Ant to set up your development environment, and the fact that the software goodies you need are available on the included CD. Struts does not live in a vacuum -- it is one of the tools in the developer's toolkit, so knowing how it works with other technologies is very useful.

Of particular importance is the coverage on testing your web application as you build and maintain it. Developing a solid testing methodology, and a substantial suite of tests (to protect yourself against regressions), is critically important to a rapid development cycle that still needs to produce high quality applications. Coverage of testing, though, tends to be minimal in many books about programming technologies. James and Kevin provide specific advice on how to use the JUnit and Cactus testing frameworks with your Struts based applications.

Struts Kick Start is a good resource for learning about Struts, and it will help you get up to speed quickly.

- Craig McClanahan, Creator of Struts

Table of Contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. We Want to Hear from You!
  5. Introduction
  6. Struts in Context
    1. The Parable of the Carpenter
    2. What Is Struts?
    3. State of Struts: Where Things Are Right Now
    4. Faces Behind the Code: Struts Development
    5. Where Struts Is Going
    6. Conclusions
  7. The Model-View-Controller Design Pattern: ’Model 2’ JSP Development
    1. The Model-View-Controller Design Pattern
    2. The Origins of Model 1 / Model 2
    3. How Struts Implements the Model 2 Pattern
    4. Conclusions
  8. Hello World!: A First Struts Application
    1. Hello World! Application Requirements
    2. Applying the Model-View-Controller Pattern
    3. The View Component: The HTML Form and the Form Bean
    4. MessageResources and Application.properties Files
    5. The Struts Form Bean: HelloForm.java
    6. Data Validation and ActionErrors
    7. The Controller Component: HelloAction.java
    8. The Model Component (HelloModel.java)
    9. Passing Data to the View Using Attributes: Constants.java
    10. Tying It All Together: The struts-config.xml File
    11. Conclusions
  9. HTTP Protocol: Web Application Communications and Control
    1. HTTP Protocol and the Request/Response Cycle
    2. Control Information: HTTP Headers and HTTP Response Codes
    3. HTTP Cookies and Session/User Management
    4. Conclusions
  10. JSP, Taglibs, and JSTL: Extending Java onto the Page
    1. Servlets and JSP
    2. Object Scoping with JSP
    3. Hiding Business Logic Using Beans
    4. JSP Custom Tags
    5. Web Application Deployment
    6. JSTL: The Standard Tag Library
    7. JSP and J2EE: The Big Picture
    8. J2EE and Struts
    9. Conclusions
  11. The Sample Application: A Financial Portfolio
    1. Requirements: Covering Your Rear End
    2. Starting with the Wireframes
    3. Developing Use Cases
    4. Data Sources and Storage
    5. Choosing Technologies
    6. Conclusions
  12. View Components: What the End User Sees
    1. The ActionForm
    2. JSP Files: The Alpha and the Omega
    3. The Perils of Automatic Type Conversion
    4. The html:errors Tag
    5. Internationalization
    6. Conclusions
  13. The Controller: Directing the Action
    1. The Action Class
    2. Accessing the Session and Other Form Beans
    3. User Validation and Struts
    4. Transferring Control Inside and Outside the Application
    5. Conclusions
  14. Model Components: Modeling the Business
    1. Well-Designed Models
    2. Further Isolation Techniques
    3. Conclusions
  15. The struts-config.xml File: Tying All the Pieces Together
    1. The struts-config DTD
    2. The Configuration File in Context
    3. Conclusions
  16. How the Struts Tag Libraries Work: The View from Inside
    1. Review of JSP Tag Libraries
    2. Understanding How Struts Tags Work: The <bean:page> Tag
    3. Comparison to the Java Standard Tag Library
    4. Conclusions
  17. Struts HTML Tags: Page Construction and Form Processing
    1. Struts Tags, JSP Custom Tags, and Java Scriptlets: What’s the Right Balance?
    2. Using Struts HTML Tags to Render Basic HTML Elements
    3. The Basics of Form Processing
    4. Check Boxes and Radio Buttons
    5. Drop Downs and Select/Option Lists
    6. Input Validation and <html:errors>
    7. Uploading a File Using <html:file>
    8. Conclusions
  18. Struts Bean Tags: Storing and Passing Data
    1. Using Struts Bean Tags That Access Aspects of the Servlet Context
    2. Using Struts Bean Tags That Access Java Resources
    3. Using Struts Bean Tags That Access Bean Properties
    4. Conclusions
  19. Struts Logic Tags: Conditional Presentation Logic
    1. Using Struts Logic Tags That Perform Conditional Display Based on a Value
    2. Using Struts Logic Tags That Match Substrings
    3. Using the Struts Logic Tags for Iteration
    4. Using the Struts Logic Tags to Test for Absence or Presence of Values
    5. Using the Struts Logic Tags to Transfer Control
    6. Conclusions
  20. The Nested and Template Struts Tag Libraries: Handling Subproperties and Inserting Content
    1. Using the Struts Nested Tags
    2. Using the Struts Template Tags
    3. Conclusions
  21. The Struts Tiles Tag Library: Creation Master Document Templates
    1. A Tiles Overview
    2. Enabling Tiles
    3. The Definitions Configuration File
    4. Writing JSP Files for Tiles
    5. Modifying Your Actions
    6. Putting It All Together
    7. Other Aspects of Tiles
    8. Conclusions
  22. DynaForms and the Validator
    1. DynaForms: Forms Without Java
    2. The Validator: Automating Field Checking
    3. Conclusions
  23. Using Struts with Enterprise JavaBeans
    1. EJBs Fit with Model Components
    2. Quick Review of EJB Technologies
    3. Using Different EJB Types with Struts
    4. A Struts/EJB Sample Application
    5. Conclusions
  24. Using Struts with Web Services
    1. Web Services Fit with Struts Model Components
    2. A Quick Review of Web Service Technologies
    3. How to Use Struts with a Web Service
    4. A Struts/Web Service Sample Application
    5. Conclusions
  25. Building, Deploying, and Testing Struts Applications
    1. An Integrated and Incremental Build/Test Cycle: It’s Extreme!
    2. Building and Deploying Struts Applications Using Jakarta Ant
    3. Developing a build.xml File for Building Struts Applications Using Ant
    4. Extreme Struts Development with Integrated and Ongoing Testing
    5. Mock Object Testing Using JUnit, StrutsTestCase, and Ant
    6. In-Container Testing Using Cactus, JUnit, StrutsTestCase, and Ant
    7. Conclusions
  26. Installing Struts and the Sample Applications from the CD
    1. Listing of Applications Included on the Companion CD-ROM
    2. Step 1: Install the JDK and Tomcat
    3. Step 2: Install MySQL
    4. Copy the WAR Files to the Tomcat webapps Directory
    5. Restart Tomcat
  27. Index