Creating a JSP application

This tutorial demonstrates how to create a JSP application; select and apply a template; create an XML application; and create a server-side click-across event to link a displayed column (Headline) to a hidden column (URL). This tutorial also shows how to use grid rules to optimize data presentation on a mobile device. (See the Unwired Accelerator Developer’s Guide for more information about grid rules). The resulting NewsStory application enables you to select a headline and display the corresponding news story.

This tutorial is divided into several procedures, so you can refer to them later when you create your own applications.

StepsCreating the NewsStory (JSP) application

  1. Log in to Mobile Web Studio.

  2. Select Applications in the left pane, and click the New button to launch Application Builder.

  3. In the Application Builder, click the down arrow next to the Add button. In the menu that appears, select JSP Element.

  4. In the JSP Element window, enter:

    NoteFor remote JSP applications, only applications containing grid data or simple HTML are supported on Wireless Application Protocol (WAP) devices.

  5. Click Preview to preview the JSP page showing Yahoo’s Web site. If you do not see the Yahoo Web site, verify your input; you must see the Yahoo Web site before you go on.

  6. Click Next to continue.

  7. In Element Name, enter documentdisplay, and click Finish. The document display element is added to the Element List in Application Builder.

    Figure 2-1: Document display element

    The JSP application does not yet display in the Application Builder preview pane. You must change the template so that the IFRAME in the document display JSP expands and fills the application’s available screen space.

  8. Click the Template button in Application Builder.

  9. In the Find Template window, verify that “html” is selected from the Type drop-down list, then click Search.

  10. When the template list appears in the detail pane, select the OP Basic template, and click Select. (The template name indicates the template layout; for example, OP-1-1 Basic means the template creates a table with one row and one column).

  11. The Find Template window closes and the template is applied to the application. It may take a few moments for the new preview of the application to appear showing the Yahoo.com Web site in the preview pane.

  12. In the Application Builder window, click Save.

  13. On the Finish window, make these entries; for all other fields, accept the defaults:

    Content tab Name – enter NewsStory (no spaces).

    Presentation tab Select No Popup.

  14. Click Finish to create the application.

  15. Click OK to confirm.

  16. Click the Close button in the upper-right corner to close the Application Builder window.

  17. In Mobile Web Studio, approve the application:

  18. Select Approved from the Application Manager Status menu. You see the NewsStory application in the detail pane.

  19. You can preview the NewsStory application, although it is not yet complete:

StepsCreating the TopNews (XML) application

In this step, create an XML application called, “TopNews,” and use grid rules to modify its presentation for the mobile device. You will display the three most important columns, and identify two hidden columns, one of which will be used in a click-across event.

NoteCurrently, only JSP templates are valid for mobile applications.

  1. Log in to Mobile Web Studio.

  2. Select Applications in the left pane, and click the New button to launch Application Builder.

  3. Click the arrow to the right of Add, and select XML Element. You see the XML Element Definition window.

  4. In XML URL, enter:

    http://www.moreover.com/cgi-local/page?o=xml_1&c=Top%20US%20stories
    
  5. For Content XSLT, click the Select button next to the text box. The Find XSLT Template window displays.

  6. In Type, make sure the drop-down list is set to XSL, and click Search in the upper-left corner of the window. A list of templates displays in the detail pane.

  7. Click the moreover_content_xsl template.

  8. Click Select to set this as the Content XSLT template for the XML Element. The Find Template window closes.

  9. On the XML Element Definition window, click Preview to test the settings entered. After a few moments a seven-column table with multiple rows displays in the Preview pane.

  10. Click Next to continue.

  11. Use the Define window to identify record 1 as the header row. In the Define Record Layout section, click “Records contain labels.” When the “Labels are displayed in Record” option displays, accept the default, 1. Click Next.

  12. On the Filter window, rename the headers of the second column:, third, fourth, sixth, and seventh columns. The procedure for changing the headers is the same for all the columns:

    To change the header of the second column:

    1. In the left-most drop-down list, select “Edit Record.”

    2. Make sure the second drop-down list is set to “number.”

    3. In the first text box, enter 1 to indicate the first record.

    4. For Field, select “number.”

    5. In the second text box, enter the number of the column of which you are changing the name, for example 2 to indicate the second column.

    6. In the fourth drop-down list, select “value” from the “value/image” drop-down list.

    7. In the third text box, enter a name for the field. For example, for column 2, enter URL. This creates the header title for the column.

    8. Click Add. In Preview, the field title has changed to the value you entered, and a new rule is added under Current Filter Rules.

    This table shows the values to enter for each column:

    Col 2

    Col 3

    Col 4

    Col 6

    Col 7

    Step e

    2

    3

    4

    6

    7

    Step g

    URL

    Headline

    Source

    SourceURL

    Date

    Click Next.

  13. In the Configure Parameters window, click Next.

  14. The Preview window displays the modified table in the lower part of the screen. Only Headline, Source, and Date are displayed (3,4,7) in grid format.

  15. In Element name, enter TopNews (no space) as the XML Element name, and click Finish.

    The XML Element Definition wizard closes and the XML Element displays under the Element List in the Application Builder window.

  16. In the Application Builder window, click Save.

  17. In the Finish window, make this entry; accept the defaults for all other fields:

    Content tab Name – enter TopNews (no space).

  18. Click Finish.

  19. Click OK to confirm.

  20. Click Close in the upper-right corner to close Application Builder.

  21. Click New under Application Manager Status in the middle pane. The TopNews application displays in the detail pane. Do not approve it yet.

StepsDefining a click-across event

In this step, define a server-side click-across event for the TopNews application that links the Headline field with the hidden URL field. You also use a grid rule formula to link the two fields.

  1. Right-click TopNews in the detail pane, and select Define Events.

  2. In the Define Click-Across Events window, click Select to the left of the data grid. The hidden fields (URL and SourceURL) are included in the grid.

  3. Click Next to continue.

  4. Under Assign An Event, enter these values:

  5. In the Assign An Event section, click Add. After a moment, the second field in the grid is highlighted in blue to show the event is defined for the field. The fields are underlined indicating a link is established. This is the link to the hidden URL field.

  6. Click Next to continue. You see a preview of the application for which the event was defined.

  7. Click Finish to save the event definition to the application.

  8. In Mobile Web Studio, approve the application:

  9. Select Approved from the Application Manager Status menu. You see the NewsStory application in the detail pane.

StepsPreviewing the TopNews application

  1. Select the TopNews application in the detail pane, and click Preview. The Web site where the news story is located displays.

  2. Select a Headline link.

  3. Verify that the correct article displays.

  4. Close the window.

StepsApproving the application

  1. Right-click the TopNews application in the detail pane, and select Approval Status | Approved.

  2. Click OK to confirm.

  3. Select Approved under Application Manager Status and verify the TopNews application displays.