 |
Preface
Creating a robust screen flow for a web application is not a simple task. Many issues must be taken into account, like dealing with input data, updating domain model, tracking current page, synchronizing page with model, protecting from double submits, timely allocation and deallocation of objects, generating and preserving messages, error handling.
Easy Wizard allows to create a robust and controlled flow of application pages in the uncertain world of stateless HTTP requests. It is targeted on relatively short page sequences, known as wizards. A wizard is a UI component, designed to input data in portions step by step. A wizard usually has the following qualities:
- All wizard data compose a single transaction.
- Steps are processed in sequence from beginning to end.
- There is one starting step, several intermediate steps, and one ending step.
- The wizard validates its state before advancing to the next step.
- There can be several different paths to reach the ending step.
- It is possible to navigate back to review and update values entered in previous steps.
- A wizard can be cancelled before completion.
A wizard must execute its steps in the correct sequence. This is difficult to achieve in a web application, because a user can jump from page to page, or can leave the application, browse another web site, and then return back. It is possible to restrict a user to a certain step order by controlling page sequence. But a model-driven approach seems to be more robust, cleaner, and easier to implement, and provides better integration with the application domain model.
Easy Wizard uses the concept of Finite State Machine (FSM) to ensure the strict flow of wizard pages. The concept of State Machine is used in other flow engines too, but Easy Wizard is different:
- Wizard state is stored completely on server, no hidden fields.
- Wizard state always depends on domain model state.
- Wizard view is always synchronized with wizard state.
- Wizard state is an object, and contains model data or refers to it.
- Wizard transition is an object, and can validate itself, taking into account domain model standing.
- Back, Forward and Refresh buttons are safe to use.
- Error messages are not lost on page refresh.
- A wizard can be reconfigured in runtime.
- Wizard rules are defined completely in Java, no XML configuration files, no server-side Javascript.
- Wizard rules and domain model integration can be tested using base JDK classes only, without user interaction.
- Self-contained, can be easily integrated into most Java frameworks.
- Can be used as a component.
The goal of Easy Wizard is to provide the same level of confidence and robustness for web-based page flow, as desktop wizard or tabbed notebook component. It may not satisfy those who want to get a templated control, like Login Control in ASP.NET 2.0. Current version of Easy Wizard does not tackle with page design, leaving it completely up to the user. However, Easy Wizard will help you to maintain proper order of pages, at the same time keeping the pages in sync with wizard state machine and with underlying domain model. Also, you will be relieved from worries related to double submits, losing of messages or uncontrolled data updates.
If you are new to Easy Wizard or to Struts, please start from an online demo: New User Signup Wizard. Play with the wizard, try to refresh any page, to use browser navigation buttons, to go back and forward; leave the wizard, navigate somewhere else, then return back and check its state; try to cancel wizard, to start it again, to use invalid values, just try to break it.
If you like what you see, than proceed with reading. You will be able to create the same and even better wizards very soon.
|