Training > All Courses > Java EE > Struts 1.x

Course Summary

  • Fully understand the Struts architecture
  • Gain proficiency with JSP tag libraries and expression language (EL)
  • Learn work-saving additions (and alternatives) to JSP
  • Gain hands-on familiarity with key Struts APIs
  • Master basic and advanced formatting, conversion, validation, and error messaging
  • Know and understand major integration points
  • Learn to design and code controller logic for real-world problems
  • Discover how to integrate AJAX functionality

Duration

5 days.

Objectives


Get a clear understanding of the Struts framework during this fast-paced, five-day intensive. You'll learn techniques that will allow you get the most out of Struts while avoiding common pitfalls. And you'll also get plenty of practice—along with one-on-one attention from one of our expert instructors—during extensive lab exercises that will help you gain hands-on proficiency fast.

Introduction to Struts 1.x begins with a brief overview of the history of Struts, its current ecosystem, and its high-level architecture to provide context, and then moves quickly on to the basics of developing Struts applications. A sequence of lab exercises—all conducted using the Eclipse IDE and Tomcat application server—progresses quickly from the rudiments of Struts to working with complex form submissions.

You'll learn how to use XML to configure navigation and other aspects of your application's runtime behavior; where to extend Struts base classes to integrate your Java code; and the best techniques for developing JSPs with tag libraries, EL, and add-on frameworks such as Tiles. In addition to getting a solid grounding in these and other fundamentals, you'll also get to explore more advanced topics.

You'll learn how to dramatically streamline Struts development by leveraging existing solutions for underlying framework issues that affect validation, type conversion, and other core functionality. And you'll learn about multi-module development, security, list management, AJAX integration, and migration paths from Struts 1.x to other frameworks (including Struts 2).

Audience

This course is for you if you are an experienced Java developer (or at a minimum, have taken Java Programming or the equivalent) who wants to learn to develop web applications using the Struts 1.x framework. A basic understanding of the Servlet architecture and experience with JSP are helpful, but not required.

Additional Notes

Links


For additional information on Struts, please visit:

The Struts framework project website: http://www.struts.apache.org
Wikipedia entry on Apache Struts: http://en.wikipedia.org/wiki/Apache_Struts

Outline

1. What is Struts?

    * The Apache Software Foundation
    * Servlets and JSP
    * MVC and the Rationale for Struts
    * Tag Libraries
    * Action-Based vs. Component-Based
    * What Struts Does
    * What Struts Doesn't Do
    * Struts 1.x vs. Struts 2.x

2. Overview of Struts Architecture

    * The FrontController Pattern
          o ActionServlet and RequestProcessor
          o Plugins
    * Forms and Actions
          o Form validation and type conversion
          o ActionMessages
          o Action pooling and its consequences
    * Managing Navigational Flow
          o struts-config.xml
          o ActionForward
          o Form bean instantiation
    * Formatting, Coercion, and Validation
          o The role of commons-beanutils
          o Type coercion pitfalls
          o Approaches to validation
          o Use of commons-validator

3. Struts Application Basics

    * Configuration
          o web.xml
          o struts-config.xml
          o Forwarding to HTML pages
          o Invoking an Action method
          o Passing a form bean instance
    * Coding an Action
          o Signature
          o Exceptions
          o Forwarding
    * Coding an ActionForm
          o Mapping elements to properties
          o Overriding validate()
          o The purpose of the reset() method
          o Form initialization caveats
    * Coding the View
          o JSP and taglibs
          o Working with HTML
          o Templating alternatives
          o Deploying a Struts Application
          o Build tools (ANT vs. Maven)
          o App server configuration
          o Libraries and TLDs
          o WAR deployment
          o Exploded deployment
    * Troubleshooting Deployments
          o Missing JAR files
          o DTDs and internet connections
          o web.xml issues
          o struts-config issues

4. Working with Forms

    * The Form Bean Life Cycle
          o Scoping considerations
    * Configuring the View
          o Setting the form's action
          o Input elements
          o Submit and Button elements
          o Button ordering
          o Hyperlinks and Javascript
    * The Binding Mechanism
          o RequestProcessor behavior
          o Role of commons-beanutils
          o Type coercion and formatting issues
          o Formatting and coercion workarounds
          o Alternative binding mechanisms
    * Form Validation
          o Overriding validate()
          o Posting error messages
          o Managing formatting and coercion

5. Validation Alternatives

    * Working with commons-validator
          o Struts Validator integration
          o Type-based validation
          o Using built-in validation rules
          o Cross-field validation
          o Custom validations
    * StrutsLive Validation
          o Leveraging automatic type-based validation
          o Writing custom Formatters
          o Registering ValidationRule instances
          o Using HTML bindings

6. Designing Actions

    * Separation of Concerns
          o Working with model objects
          o Enriching the controller layer
          o Strategies for decoupling persistence
          o Unit test considerations
    * Messaging and Error Handling
          o Exception handling
          o Posting ActionMessages
    * Method-Level Dispatching
          o DispatchAction
          o StrutsLive custom dispatching

7. Working with JSP

    * Struts Tag Libraries
    * JSTL and EL
    * Displaying messages
    * Managing selection
          o Select lists and options
          o Multi-select lists
          o Checkboxes
    * Working with MessageResources
    * Alternatives to JSP
          o Velocity
          o Semblance

8. Configuring Applications

    * Deployment Descriptor (web.xml)
          o URL patterns
          o Configuring additional servlets
          o Tag libraries
    * Configuring Plugin Classes
    * Adding MessageResources files
    * Changing the Controller Class
    * Global Exception Handling
    * Forwarding
          o Global forwards
          o Input and inputForward
          o ForwardAction
          o ForwardingActionForward
    * Parameters
          o Passing a parameter to an Action method
          o Using set-property to pass values

9. Tiles Templating

    * Struts Integration points
          o Configuring RequestProcessor
          o Extending base class
    * Designing the Layout
          o Designing templates
          o Configuring pages
          o Tiles JSP tags
          o Working with Tiles XML

10.Working with Lists

    * Challenges
          o Lack of built-in controller support
          o Limitations of JSP components
    * List Presentation Extensions
          o DisplayTag Tag Library
          o StrutsLive ListView

11.Security

    * Controlling access to URLs
    * Securing resources
    * Conditional rendering

12.Working Across Tiers

    * Abstracting Services
    * Using IOC Containers
    * Connecting to the Database
    * Working with DAOs

13.Multi-Module Development

    * Modular struts-config files
          o Configuring in web.xml
    * Scoping form bean keys
    * Forwarding to an Action in another

14.AJAX Integration

    * DWR
    * Google Gears
    * Dojo

15.Integrating with Other Frameworks

    * Migrating to Struts 2
    * JSF Integration
    * Spring Integration
    * StrutsLive
    * Hibernate and other ORMs