Web Flow And Wizards
Web flow and wizards are a breeze in Tapestry. In this example to apply for credit:
- A common look for the pages is provided by a component, WebFlowLayout.
- Progress through the steps is shown on the left by a component, WebFlowProgress.
- Navigation decisions are made in a superclass of the pages, WebFlowBasePage.
- State is held in an object, CreditApplication, in the superclass of the pages.
In a more complete example, the state object would typically be a business object, annotated with @Entity
and saved to the database when the credit application is processed. It could also be a more complex object -
the root of a tree of business objects eg. the CreditApplication object could contain 2 Applicant objects,
each of which could hold Address objects. All of this would still be accessible in the page with ognl, eg.
ognl:creditApplication.applicant1.homeAddress.street
- Validation decisions are made by the individual pages when the Next button is pressed.
They invoke various validation methods of the state object. See doNext() in each page.