0%

Book Description

Master Spring's well-designed web frameworks to develop powerful web applications

About This Book

  • Design, develop, and test your web applications using the Spring Web Flow 2 framework
  • Enhance your web applications with progressive AJAX, Spring security integration, and Spring Faces
  • Stay up-to-date with the latest version of Spring Web Flow
  • Walk through the creation of a bug tracker web application with clear explanations

Who this book is for

This book is targeted at Java web application developers who want to work on Spring Web Flow. This book is a must-read for those who desire to bridge the gap between the popular web framework and the popular application framework. It requires prior knowledge of the Spring framework, but no prior knowledge of Spring Web Flow.

What You Will Learn

  • Explore the features of Spring Web Flow 2 to develop powerful applications
  • Extend the framework to take it beyond its out-of-the-box feature set
  • Get started with Spring Faces, Spring JavaScript, and Spring Binding and improve the handling of the web flow
  • Test your Spring application and rest assured of its quality before going live
  • Secure your web applications using Spring Security and Spring Web Flow
  • Integrate JavaServer Faces (JSF) with Spring Web Flow to organize and manage the storage of data inside your web application

In Detail

Many web applications need to take the user through a defined series of steps such as e-commerce checkouts or user registrations. Spring Web Flow works well for rich and flexible user interaction, additionally it helps you to describe the flow of websites in complex processes. Spring Web Flow 2 provides the perfect way to build these kinds of features, keeping them secure, reliable, and easy to maintain.

This book provides a platform on which you can build your own applications and services. It gives detailed information on Spring basics and covers core topics involving testing, security, and so on. We develop a complete, robust web application using the latest version of Spring, where page navigation is done on-the-fly.

This book teaches you how to work with Spring Web Flow. It covers both basic and advanced aspects and provides a detailed reference of the features Spring Web Flow. The book helps readers to extend the framework.

The integration of Spring and Java Server Pages is clearly explained in the book. The book also explains the essential modules of the complete Spring framework stack and teaches how to manage the control flow of a Spring web application.

The Spring Faces module will provide integration between Spring Web Flow and Java Server Faces (JSF). Testing, an important aspect of the software development process is covered towards the end; the question of how to test a Spring Web Flow application is answered.

A practical guide to designing powerful web applications with the Spring Web Flow framework

Style and approach

This book is a tutorial, with plenty of step-by-step instructions beginning with "getting started" material, followed by advanced coverage of this technology. The book has a practical approach towards the Spring MVC framework and is packed with practical examples and code.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Spring Web Flow 2 Web Development
  2. Credits
  3. About the Authors
  4. About the Reviewers
  5. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code for the book
      2. Errata
      3. Piracy
      4. Questions
  6. 1. Introduction
    1. Three cornerstones: Spring, Spring MVC, and Spring Web Flow
      1. Spring Framework
      2. Spring MVC
      3. Spring Web Flow
    2. What is Spring Web Flow
      1. The elements of Spring Web Flow: flow, view, and conversation
        1. Flow
        2. View
        3. Conversation
      2. The Spring Web Flow elements: an example
    3. The new major release: Spring Web Flow 2.0
      1. Spring Web Flow
      2. Spring Faces
      3. Spring JavaScript
      4. Spring Binding
    4. Introduction to a new version
      1. Automatic model binding
      2. Support for a new expression language
      3. Flash scope is now a real flash scope
      4. Spring Faces
      5. Flow managed persistence
      6. External redirects
    5. Summary
  7. 2. Setup for Spring Web Flow 2
    1. Installation of Spring Web Flow 2
      1. Inside the distribution
      2. The examples inside the distribution
        1. Building the examples from the source code
        2. Installing the examples on your local machine
    2. Support for developers
      1. Build systems
        1. Ant
        2. Maven
      2. IDE
        1. Eclipse and Spring IDE
        2. NetBeans
    3. A sample for a quick start
      1. Overview over the example
      2. The basics
      3. Building the service and database layer
      4. The web.xml file
      5. Dependencies
    4. Summary
  8. 3. The Basics of Spring Web Flow 2
    1. Elements of a flow
      1. The entry point to the flow
      2. Section head
      3. Section data
        1. The metadata of a flow
          1. Persistence context
            1. FlowScoped Persistence Context
              1. Direct usage of persistence-context
              2. Usage of the persistence-context attribute
        2. Section input
        3. Programming in a flow
        4. The scopes
          1. Resolving variables
        5. The flow instance variables
        6. Assign a value to a scope variable
        7. Access the value of a scope
        8. Inputs
      4. The states
        1. The start-state
        2. The action-state and execution of business logic
          1. Details of a transition
        3. The view-state
          1. Validation inside the view-state
            1. More details about validation
        4. The decision-state
        5. The subflow-state
        6. The end-state
      5. The exit point
      6. Section footer
        1. global-transitions: global handling of events
        2. on-end: execution of actions at the end of the flow
        3. output: output of the flow
        4. exception-handler: exceptions between the execution of a flow
        5. bean-import: declaring beans for a flow
      7. Internals of building a flow
    2. Configuration
      1. FlowRegistry
      2. FlowExecutor
      3. FlowExecutor Listeners
      4. Internals of the Webflow Configuration
      5. Inheritance inside a flow definition
        1. Inheritance for flows
        2. Inheritance for states
        3. Merge or no merge
    3. The complete flow for the example
    4. Summary
  9. 4. Spring Faces
    1. Enabling Spring Faces support
      1. Inside the Facelets technology
      2. The ResourceServlet
        1. Internals of the ResourceServlet
      3. Configuration of the application context
    2. Using Spring Faces
      1. Overview of all tags of the Spring Faces tag library
      2. A complete example
        1. Creating the input page
          1. The Header part
          2. The Name part
          3. The Description part
          4. The Fix until part
          5. The Buttons part
        2. Handling of errors
        3. Reflecting the actions of the buttons into the flow definition file
        4. Showing the results
    3. Integration with other JavaServer Faces component libraries
      1. Integration with JBoss RichFaces
      2. Integration with Apache MyFaces Trinidad
    4. Summary
  10. 5. Mastering Spring Web Flow
    1. Subflows
    2. Spring JavaScript
      1. What is AJAX?
      2. Installing Spring JavaScript
        1. The first example with Spring JavaScript
      3. Apache Tiles integration
        1. Tiles and AJAX
    3. The Web Flow configuration
      1. flow
      2. attribute
      3. secured
      4. persistence-context
      5. var
      6. input
      7. output
      8. actionTypes
        1. evaluate
        2. render
        3. set
      9. on-start
      10. on-end
      11. transition
      12. global-transitions
      13. exception-handler
      14. bean-import
      15. action-state
      16. view-state
      17. decision-state
      18. subflow-state
      19. end-state
    4. Summary
  11. 6. Testing Spring Web Flow Applications
    1. How to test a Spring Web Flow application
      1. The first example
      2. A look into the source code
      3. First steps in testing
      4. Testing Persistent Contexts
        1. A short introduction to EasyMock
      5. Testing subflows
      6. More testing with EasyMock
    2. Summary
  12. 7. Security
    1. Introducing Spring Security
    2. Installing Spring Security
    3. Basic authentication with Spring Security
      1. Setting up your web.xml
      2. Advanced Spring Security configuration
      3. UserDetails
      4. Using database access to retrieve users
      5. Securing parts of a web page
      6. Securing method invocations
    4. Using Spring Security with Spring Web Flow
      1. Changing the user's password
    5. Summary
  13. A. flow.trac:The Model for the Examples
    1. flow.trac
      1. Item
      2. User
      3. Role
      4. Project
      5. Issue
      6. Type
      7. Priority
      8. Comment
      9. Attachment
    2. Summary
  14. B. Running on the SpringSource dm Server
    1. Introduction to the SpringSource dm Server
    2. Installation of the SpringSource dm Server
    3. Migrating an application
    4. Summary
18.225.98.177