# How Do I: Create a Page Flow?

When you create a new Web project, WebLogic Workshop automatically creates a number of files and other resources for you. One of these files is the page flow controller (JPF) file. We will show how to do this below.

If you want to add an additional page flow to an existing web project, you will need to add a new page flow controller (JPF) file. You can also create a nested page flow in the Flow View of an existing page flow. Both procedures are described below.

Note: You can only have one JPF file per (sub)folder in a Web project. When you add a new page flow, WebLogic Workshop will automatically put the JPF file in a new folder.

To Create a Page Flow in a New Web Project

Before you can create a new web project, the application in which the web project will reside must be open. For information about creating a new application, see How Do I: Create a New Application?

To create a page flow in new web project:

1. In the Application tab, right-click the top-level folder representing your application, and select New-->Project. The New Project dialog appears.
2. In the upper-left pane, select Web User Interface.
3. In the upper-right pane, select Web Project.
4. In the Project Name field, enter a name for the web project. This name becomes part of the URL used to access JSPs. Click Create.

The web project folder is created and a number of files are added, such as the controller file, a resources folder containing for instance the style.css file in the css subfolder, and the WEB-INF folder containing among others the Global.app file in the src/global subfolder.

To Create a New Page Flow in an Existing Project

To create a new page flow in an existing web project:

1. In the Application tab, right-click the web project folder, and select New-->Page Flow. The Page Flow Wizard appears.
2. In the Page Flow Name dialog, enter a name for your page flow. This name will be used to name the folder that will contain the various page flow (JPF and JSP) files, and becomes part of the URL used to access the JSPs. As you type the page flow's name, notice that the controller class file is named similarly to the folder name. Click Next.
3. In the Select Page Flow Type dialog, select either the Basic page flow or Page flow from a java control option.

   If you chose the "Basic page flow" option and click Create, the Page Flow Wizard will create the new page flow folder containing a page flow controller file with a begin action method, and a default index.jsp file that together serve as a starting point for your work.

   If you chose the "Page flow from a java control" option, select the control you want to use in your web application and click Next. On the next page, select the actions you want to create in the page flow and click Create. The Page Flow Wizard will create the new page flow folder containing a page flow controller file with the action methods you selected, and the associated JSP files. If you need to first create the Java control, cancel the Page Flow Wizard and create the control. For information about creating a Java control, see Working with Java Controls. You might also be interested in How Do I: Create a Database Control Page Flow?

To Create a Nested Page Flow in an Existing Page Flow

You can easily create a new nested page flow in an existing page flow's Flow View. When you follow the below procedure, a new page flow and various action methods to navigate between the two page flows are created.

To create a new nested page flow in an existing page flow:

1. Select the Page Flow icon in the Palette window, and drag and drop the icon on the controller's Flow View. The Page Flow Wizard appears.
2. In the Page Flow Name dialog, enter a name for your page flow. This name will be used to name the folder that will contain the various page flow (JPF and JSP) files, and becomes part of the URL used to access the JSPs. As you type the page flow's name, notice that the controller class file is named similarly to the folder name. Also notice that the Make this a nested page flow checkbox is already selected. Click Next.
3. In the Select Page Flow Type dialog, select either the Basic page flow or Page flow from a java control option. For more information about these options, see the corresponding step in To Create a New Page Flow in an Existing Project above. When you have made your selection, click Create.

WebLogic now creates a number of components:

- In the existing page flow's Flow View, a new page flow icon is created as well as a ghost action icon, representing the action method that will be called when exiting the nested page flow. You can either create the ghost action icon here by right-clicking the icon and selecting Create, or, in the nested page flow, you can call a different action method upon exiting the nested page flow. The latter procedure is described below.
- The nested page flow's folder is created containing (among other files) the controller (JPF) file. In this controller's Flow View, a done action is created pointing at an exit action bearing the same name as the ghost action icon in the parent page flow. If you want to change the done action to, for instance, invoke the begin action in the parent page flow, double-click the done action to go to the action method's source code, and change its jpf:forward tag as follows:

  @jpf:forward name="done" return-action="begin"

  When you go to the parent page flow's Flow View, you will notice that the arrow from the corresponding page flow icon now points at the begin action.

Related Topics

Guide to Building Page Flows

How Do I: Create a Database Control Page Flow?

How Do I: Define an Action That Forwards Users to Another Page?