Web Flow And Wizards
Web flow and wizards are a breeze in Tapestry. In this example to apply for credit here's what will see that:
- The WebFlowLayout component provides a common look for the pages.
It holds this text and all the other components on every page.
- WebFlowStartPage, WebFlowApplicant1Page, etc. are the pages themselves.
Each one uses the WebFlowLayout component which in turn puts their body in the larger of the two grey areas on the page.
- The WebFlowProgress component is the grey block on the left side that shows your progress through the steps.
- The WebFlowBasePage class is the superclass of all pages, providing navigation decisions.
- A CreditApplication object holds the current state of your entered data. It resides 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.