# How Do I: Create a Database Control Page Flow?

If you have an existing database control, WebLogic Workshop can autogenerate a page flow based on the methods in the database control file. You can use the autogenerated page flow as a management tool for the database, or as the basis for other web applications that use the database. The features of the generated page flow depend on the kind of database control you are starting with. In the current topic we use the RowSet control, which itself was autogenerated from a database. For more information on how to autogenerate a RowSet control from a database, see How Do I: Create a RowSet Control to Access a Database? If your database control is not autogenerated, then WebLogic Workshop will make a Page Flow containing "best guess" actions based on the methods in the database control.

If the RowSet control contains all the query methods to provide full access to the database, then Workshop will generate a standard page flow containing four JSP pages:

- A details page for viewing individual records
- An update page for editing individual records
- An insert page for adding new records
- A grid (overview) page for viewing multiple records simultaneously

To Create a Database Control Page Flow from an Existing RowSet Control

1. Before you begin, you should ensure that each method of the RowSet control references a complete SQL statement. In some cases, a RowSet control wizard will generate methods with incomplete SQL statements. Incomplete SQL statements are generated with the word "TODO" included in them. For example,
   SELECT TAXID,FIRSTNAME,LASTNAME,CURRENTLYBANKRUPT FROM WEBLOGIC.BANKRUPTCIES WHERE TAXID = ( TODO: Add sql to retrieve newly inserted row for user entered primary keys-WEBLOGIC.BANKRUPTCIES)
   Complete the SQL statements according to the syntax of your particular database.
2. On the Application tab, right-click the RowSet control (JCX) file and select Generate Page Flow. The Page Flow Wizard appears
3. The Page Flow Wizard displays a Page Flow Name screen. 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. Optionally you can select the Make this a nested page flow checkbox. Click Next.
4. On the Select RowSet Operations screen, in the Actions to allow section, choose the kinds of actions you want to have available in your page flow.
   In the Show the Details View section choose how you want to link to views of individual records in your database. When you select the a Details link column radio button, the generated overview table will contain a linked Details column implemented as a netui-data:anchorColumn tag which will forward you to the details page for an individual record. If instead you want to link one of the record fields' columns, select a link on the following column and select the record field. For more information on the netui-data:anchorColumn tag and the other grid tags, see Presenting Complex Data Sets in JSPs.
5. Click Create.

Related Topics

Presenting Complex Data Sets in JSPs

Database Control

Getting Started with Page Flows

A Detailed Page Flow Example