Wizards in the JSP console
A wizard view is used to accept multiscreen inputs. A wizard view consists of one or more wizard pages. Each wizard page is defined as a detail view.
Wizard view is permission controlled, priority driven, and contains wizard definition XML. A wizard view consists of the following components:
- Wizard Definition—A wizard definition contains one or more wizard entity (wizard page or wizard rule) definitions and one or more wizard transition definitions. A wizard definition defines the flow of the wizard.
- Wizard Servlet—A wizard servlet handles the following wizard-related
tasks:
- Determining the wizard view permission
- Calculating the wizard rule from the wizard definition XML
- Handling the data posted by the previous wizard page
- Calling Detail servlet to determine the detail view for the current wizard page and calling the APIs corresponding to that detail view
- Wizard Anchor Page—A wizard anchor page provides placeholders for including breadcrumbs and wizard action buttons. The wizard anchor page also includes the JSP of the detail view corresponding to the current wizard page.
- Save Action—The Save element contains the list of all the APIs to be called on save action, the JavaScript handler on Finish button, and the view ID of the view that will be shown when the wizard is finished.
- Wizard Actions—You can fire four actions from a wizard view.
What are breadcrumbs?
The breadcrumbs show users their location in the wizard view. They show the path traversed by the user in the wizard view up to the current page. Breadcrumbs also allow users to go back to each of the previous pages the user has navigated through in order to get to the current page. You can define the breadcrumbs category for each wizard page in the wizard definition. Breadcrumb categories are used to determine the path traversed, and are shown in the breadcrumbs.
What is a wizard definition?
A wizard definition defines the flow of the wizard. A wizard definition consists of one or more wizard entities (wizard page or rule) and wizard transitions. You can define new wizard rules to control the flow of the wizard. The flow of the wizard depends on the output value of a wizard rule. The output of the wizard rule is compared with the wizard transition value. Wizard transition is used to transfer control from one wizard entity to another. A Wizard definition contains:
- Wizard Entity—There are two types of wizard entities:
- Wizard Page—A wizard page takes care of the UI in order to take the inputs from a user. Each wizard page is defined as a detail view and has a view ID associated with it. A wizard definition can have one or more wizard pages. Each wizard page can also specify a JavaScript that will be called on the Next action. You can also specify the breadcrumb for each wizard page. A wizard definition can have one or more wizard pages.
- Wizard Rule—A wizard rule is a logical step that performs some computations to evaluate different output values. Based on these output values, the flow of the wizard is decided. You can define both Java™ and Greex rules. A wizard definition can have one or more wizard rules.
- Wizard Transition—A wizard transition is used to transfer control from one wizard entity (wizard page or rule) to another wizard entity (wizard page or rule). Wizard transition connects sequences of wizard entities with each other. The wizard transition value is compared with the output of the wizard rule and, based on this comparison, the control is transferred to the next wizard entity (wizard page or rule). A wizard definition can have one or more wizard transitions.
Actions in wizards
From the wizard view, the following actions are possible:
- Next—On the Next action, the JavaScript performs all the validations and posts the data with an additional parameter mentioning the type of action. The Wizard servlet executes the rules and determines the next wizard page for the current wizard view. The Detail servlet is called to display the next wizard page for the current wizard view. Data from all the earlier wizard pages is merged and made available on request.
- Previous—On the Previous action, the Wizard servlet determines the previous wizard page for the current wizard view and removes all the parameters posted by that wizard page from the session. The Detail servlet is called to display the previous wizard page for the current wizard view.
- Finish—On the Finish action, the Wizard servlet calls the Save action defined for the current wizard view.
- Cancel—On the Cancel action, the Wizard servlet purges the complete wizard data from the session.
All the wizard actions post the data back to the server and the wizard servlet processes, and determines the wizard flow. Wizard actions send an additional parameter with a request mentioning the action type.
You can define JavaScript on save resource for the Finish action and the Next action on each wizard page. These JavaScripts can perform extra validations.