Lesson 10: Creating a JSF page with advanced DataWindow features

In this lesson, you design a JSF page with a master detail DataWindow. You also associate listener classes to the components on the JSF page.

  1. Select File|New|Web Page from the main menu bar to create a new JSP page.

  2. In the New Web Page File wizard, select MySybStore_Tutorials_Web/webroot as the parent folder, type Inventory as the File name, and click Next.

  3. The Select A Template page opens. Select JavaServerPages_Basic from the Available Templates list and click Finish to complete the page creation.

    The Inventory page is created and displays in the page editor.

  4. Select Window|Show View|Palette from the WorkSpace main menu. bar

    NoteIf you do not see Palette on the list, click Other. When the Show View dialog box opens, select Basic|Palette and click OK.

  5. In the Palette, expand JSF HTML select the OutputText control, and drag and drop it onto Drag and drop Web page content here. in the editor.

  6. Place the cursor after Output Text in the design pane and press Enter twice to add two break tags (<br>) after Output Text.

  7. Select OutputText in the page editor, select the Properties tab, and type Inventory Item in the Value field.

  8. In the WorkSpace Navigator, expand MySybStore_Tutorials_Web/webroot/WEB-INF/pb/tutorial.pbl to display the DataWindows in the tutorial.pbl DataWindow library folder.

  9. From the DataWindow list, select the warehouseinv DataWindow and drag and drop it onto the page editor below Inventory Item.

  10. Select the DataWindow in the design page. In the Properties view, select the Attributes tab, find the connectionString property, and change the port number to 2658 as the connection port to the database.

  11. Maximize the Properties view, select the Quick Edit tab, find the Show Navigation Bar property, and select false from the drop-down list.

  12. In the Properties view, find the Object Links section and click Add to attach a link to another DataWindow.

  13. When the Create Objectlink dialog box opens, complete these options:

  14. In the Link Arguments table, change the Name to itemnum, select DW Column from the Type drop-down list, change Value to item_num, then click OK.

  15. Minimize the Properties view, then maximize the editor.

  16. In the editor, move the cursor to the end of the warehouseinv DataWindow and press Enter twice to add two <br> tags.

  17. Minimize the editor to see the other views.

  18. In the WorkSpace Navigator, expand MySybStore_Tutorials_Web/webRoot/pb/tutorial.pbl, locate the orderdw DataWindow, then drag and drop it after the last <br> tag in the editor. The orderdw DataWindow displays on the page.

  19. Put the cursor after the ordersdw DataWindow and press Enter twice to add two more <br> tags.

  20. Right-click in the editor and select Show View|Properties.

  21. Maximize the Properties view, locate the OnLoadHandler property and type LoadOrderDWHandler as the value.

  22. Minimize the Properties view.

  23. Select Window|Show View|Palette to open the Palette, then drag and drop a JSF HTML CommandButton after the last <br> tag in the editor.

  24. In the editor, right-click the command button you just created and select Show View|Properties from the context menu.

  25. In the Properties view, type Submit Order for the Value of the command button.

  26. In the Properties view, scroll down to the Listeners section and click Add to add an action listener to the Submit Order button.

  27. Double-click the <f:actionListener> entry in the Listeners table, then type OrderButtonListener in the Type field.

  28. Select File|Save from the main menu bar to save the page.

  29. Right-click in the editor and select Run to test the page on the runtime server. When the Run on Server dialog box opens, select Choose an existing server. Select a server and click Finish.