### Controlling the User Path Using Page Flows

Within a Web application, a page flow links together multiple Web pages in a particular sequence, thus determining the user's path through those pages and the associated data. A page flow consists of a Java class with specially designed annotations, methods, and forms that control the behavior of Web application components; it is based on the Apache Struts framework.

You can include one or more JSP files in the page flow by adding them to the page flow folder. The JSP files can use special tags, which are understood by the page flow runtime, to raise actions. The actions in the JSP correspond to action methods that are defined in the page flow. Actions can be used to perform site navigation, pass data, or invoke back-end business logic via controls. The business logic in the page flow class is separate from the presentation code defined in the JSP files.

WebLogic Workshop makes it easy to create a page flow: click the target folder and choose File —> New —> Page Flow. The Page Flow Wizard steps you through the process of creating an initial page flow and opens it in the Page Flow Designer.

The Page Flow Designer is a graphic tool that enables you to design page flows such as the Employee page flow shown in the following figure.

Page Flow Designer—Flow View

The following table describes the page flow design tools shown in the previous figure.

Tools for Designing Page Flows

Callout # | Use this tool... | For these tasks...
--- | --- | ---
1 | Application Window | Create, view, and edit page flow files in your portal application projects. The names of page flow files end in .jpf. Each page flow consists of a folder that contains a single controller file, any JSP files that are referenced, and any other application files required by the page flow. JSP files to be included in a page flow must reside within the page flow folder.
2 | Flow, Action, and Source Views | Design your page flow in this area. Switch between the following views, as required: Flow View—Build a graphical relationship between the pages in the Web application and the actions that link the pages. Action View—Define the actions raised by the action icons in your page flow (see Figure: Page Flow Designer—Action View). Source View—Edit the source code directly to add business logic. Changes made in one view are automatically reflected in the other.
3 | Palette Window | Create a graph of icons in your page flow by dragging components from the Palette window and dropping them onto the Flow View canvas. Icon types include: Begin Action—begin() method that defines the page that is loaded and the actions that are executed when the page flow is started. This icon is required and added automatically for you when you create a page flow. Action—Method for an action that you define in the page flow controller class. Page—JSP page that is loaded when an action method runs. Page Flow—Page flow that is loaded when an action method runs. Exit—done() method that defines what happens when the user exits the current page flow. Return to Action—Redirect method that returns control to a specific action. Return to Page—Redirect method that returns control to a specific page.
4 | Data Palette Window | Define instances of Java controls and form beans to use in the page flow. Java controls make it easy to access enterprise resources, such as Enterprise Java Beans (EJBs) and databases, from within your application. A control handles the work of connecting to the enterprise resource for you, so that you can focus on the business logic of your application. Form beans define variables that are used to store form data. If an action defines a form bean, a small box appears in the lower right-hand corner of the action icon. For example, the previous figure shows that form beans are defined for the UsrInfo and logout methods.
5 | Form Bean Window | Edit a form bean defined for the selected action. If no form beans are defined for the selected action, the window is empty.
6 | Property Editor Window | Set properties for the component that is currently selected in the page flow. You can select a page flow icon by clicking on it in the Design View canvas or by selecting its name in the Document Structure window (described below).
7 | Document Structure Window | View a summary of the Java entities and page flow icons that comprise the page flow (see Figure: Document Structure Window for a Page Flow). The summary includes the Java classes, methods and signatures, variables, and inner classes defined for the page flow. You can select a Java entity or page flow icon in the Document Structure window by clicking on it. When you select a page flow icon, it is selected in the Flow or Action View canvas and you can edit its properties in the Property Editor window. You can double-click on a Java entity or page flow icon to jump to its code location in Source View.

The following figure shows the Action View for the Employee page flow.

Page Flow Designer—Action View

The Action View displays all actions and Java controls defined for the page flow, and the pages and page flows referenced.

The following figure shows the Document Structure window for a page flow.

Document Structure Window for a Page Flow

To learn more about designing page flows:

- View a demo, Designing a Page Flow, that shows how to use the page flow design tools.
- See Guide to Building Page Flows in the WebLogic Workshop Help.