|
|
|
|
Overview
This course enables the experienced Java developer to use the Spring Web Flow framework to create simple and complex web applications. Web Flow represents a powerful new approach to designing and developing web applications, and can also draw on the configuration capabilities of Spring itself. We begin with an introduction to the Spring Core module -- which implements the configurable object container available to Web Flow applications as an application context -- and get oriented to the Spring web framework, as underpinnings of the Web Flow system.
Then we dive into Web Flow itself, and develop key concepts of flow, state, transition, and action. We get moderately complex applications up and running with these elements, and see how the JavaBeans used to power a flow can also take advantage of Spring configuration and dependency injection. Then we move into more advanced techniques including custom converters, validators, and subflows. We conclude the course with a look at lifecycle and context features, such as the FlowExecutionListener.
Prerequisites
- Java programming.
- Basic knowledge of XML
- Servlets programming.
- JSP.
Learning Objectives
- Understand the scope, purpose, and architecture of Spring
- Use Spring's bean factories and application contexts to declare application components, rather than hard-coding their states and lifecycles
- Use dependency injection to further control object relationships from outside the Java code base
- Use annotations to take advantage of Spring post-processors for automated bean instantiation and wiring
- Create validators for business objects, and associate them for application-level and unit-testing uses
- Build a simple Web Flow application, with declarative control over page flows.
- Bind model beans to pages, and control when binding should and shouldn't occur.
- Invoke Java methods as actions on controllers, service objects, and other JavaBeans placed in Web Flow or Spring singleton scopes.
- Install custom data-binding logic.
- Develop validation logic for individual model beans and view states.
- Organize more complex applications into master flows and subflows.
- Observe the progress of a flow using a flow execution listener, and implement interceptors over one or more lifecycle hooks.
Course Duration
5 Days
Course outline
IDE Support: SpringIDE 2.2
- In addition to the primary lab files, an optional overlay is available that adds support for SpringIDE 2.2. Students can code, build, deploy, and test all exercises from within Eclipse, and take advantage of Eclipse WTP's built-in editors and wizards for web applications, XML files, JSPs, and more. An appendix in the coursebook introduces SpringIDE features. See also our orientation and please be advised that this is an optional feature; it is not a separate version of the course, and the course itself does not contain explicit Eclipse-specific lab instructions.
Module 1. Introduction to Spring
Chapter 1. Overview of Spring
- Java EE: The Good, The Bad, and the Ugly
- Enter the Framework
- Spring Value Proposition
- The Spring Container
- Web Applications
- Persistence Support
- Aspect-Oriented Programming
- The Java EE Module(s)
- Integrating Other Frameworks
Chapter 2. The Container
- JavaBeans, Reconsidered
- The Factory Pattern
- Inversion of Control
- XML View: Declaring Beans
- Java View: Using Beans
- Singletons and Prototypes
Chapter 3. Instantiation and Configuration
- Configuring Through Properties
- Configuration Namespaces
- The p: Notation
- Bean (Configuration) Inheritance
- Configuring Through Constructors
- Bean Post-Processors
- Lifecycle Hooks
- Integrating Existing Factory Code
Chapter 4. Dependency Injection
- Complex Systems
- Assembling Object Graphs
- Dependency Injection
- Single and Multiple Relationships
- The Utility Schema
- Bean Aliases
- Inner Beans
- Autowiring
- Auto-Detecting Beans
- @Autowired Properties
- Best Practices with Spring 2.5 Annotations
Chapter 5. Assembling Object Models
- Collections and Maps
- Support for Generics
- The Spring Utility Schema (util:)
- Autowiring to Multiple Beans
- Order of Instantiation
- Bean Factory vs. Application Context
Chapter 6. Validation
- Validators
- The Errors Object
- ValidationUtils
- Error Messages and Localization
- Nested Property Paths
Module 2. The Spring Web Module
Chapter 1. The Web Module
- Servlets and JSPs: What's Missing
- The MVC Pattern
- The Front Controller Pattern
- DispatcherServlet
- A Request/Response Cycle
- The Strategy Pattern
- JavaBeans as Web Components
- Web Application Contexts
- Handler Mappings
- "Creating" a Model
- View Resolvers
Chapter 2. Customizing Control Flow
- HandlerMapping Options
- ViewResolver Options
- Chaining View Resolvers
- Triggering Redirects
Module 3. Spring Web Flow
Chapter 1. Introducing Spring Web Flow
- Spring Web Flow
- Relationship to Spring
- How It Works: Development Time
- How It Works: Request Time
- Totally Inverted Control
- The Web Flow Schema
- Flows, States, and Transitions
- Model Beans
Chapter 2. States and Transitions
- Flows
- View States
- Transitions
- Lifecycle Hooks
- Encoding Commands in HTML Views
- Global Transitions
- Web Flow URLs
Chapter 3. Actions
- Variables
- Scopes
- Actions
- Expression Language
- Implicit Objects
- Using Spring Beans
- Action and Decision States
- Sequence of Events
Chapter 4. Beans and Scopes
- Model Beans and Binding
- Web Flow Scopes
- Flow Scope
- View Scope
- POST-REDIRECT-GET
- Flash Scope
- Spring Singletons vs. Web Flow Scopes
- @Autowired Dependencies
Chapter 5. Binding
- Binding to a Model
- The MessageContext
- Message Bundles
- Reporting Error Messages
- Converters
- The ConversionService
- A Declarative Approach
Chapter 6. Validation
- Validation
- The ValidationContext
- Registering a Validator
- Adapting Spring Validators
- The MessageBuilder
Chapter 7. Subflows
- Designing with Web Flow
- Flow Input and Output
- Subflow States
- Conversation Scope
- Subflows as Factories
- Dynamic Transitions
- Action States as Join Points
Chapter 8. Lifecycle
- Observing Flow Execution
- The FlowExecutionListener
- The RequestContext
- The FlowSession
- Java View of Flow Definitions
- Implementing Interceptors
Appendix A. Spring IDE
- Installing Spring IDE
- Naviation Features
- Auto-Completes
- Validation
- Support for Spring Web Flow
Appendix B. Learning Resources
System Requirements
Hardware Requirements (Minimum)
- 1.0 GHz, 512 meg RAM, 500 meg disk space
Hardware Requirements (Recommended)
- 1.5 GHz, 1 gig RAM, 1 gig disk space.
Operating System
- Tested on Windows XP Professional. Course software should be viable on all systems which support a Java 6 Developer's Kit.
Network and Security
- Limited privileges required
Software Requirements
- All free downloadable tools.
|
|
|
|