Create and modify a basic JSP

Note

In this lesson you create an introductory Web page and modify the look and feel of the page. Not all functionality is added at this time. The purpose is to demonstrate how easy it is to create a working Web site.

Create a 4GL introductory JSP page

In this lesson you create a Welcome.jsp page. This page provides access to other pages you create in this tutorial. You use the 4GL JSP Page wizard to create the Welcome page. 4GL capabilities make it easy to develop pages with dynamic user-driven content.

4GL JSP pages are enhanced Web pages that incorporate extensions to the Web Target object model to produce template (source) files for dynamic Web pages (where part of the Web page content changes without changing the Web page). 4GL JSP pages rely on the object model to handle data transfer, HTML generation, and JavaScript generation for server scripts.

  1. Right-click on the Customer target icon and select New. Click the Web tab in the New dialog box.

    Shown is the Web tab page of the New dialog box, with icons labeled Quick Web / J S P Page, Web / J S P Page, 4 G L Web / J S P Page, Web / J SP Data Window Page, Frame set Page, Script, Cascading Style Sheet, and J S P Web Service Proxy Wizard.

    Five wizards are available to create Web pages: Quick Web/JSP Page, Web/JSP Page, 4GL JSP Page, Web/JSP DataWindow Page, and Frameset Page. In this lesson and the next two lessons, you will use the Web/JSP Page, the 4GL JSP Page, and the Web/JSP DataWindow Page wizards.

    NoteReview the Target Name Targets created by the Target wizards are added to the Target list box at the bottom of the New dialog box. The Customer target you created displays.

  2. Double-click the 4GL JSP Page icon.

  3. Click Next.

    Type the Title Welcome in the Title text box and press Tab.

    The filename in the File Name text box defaults to Welcome.jsp.

  4. Click Next until the Specify Background Characteristics page displays.

    Specify yellow as the background color.

  5. Click Next until the Define Page Parameters page displays, accepting the wizard defaults.

    Type ID for the Parameter Name and leave the Default value empty.

    Click Next.

  6. Select the Skip EAServer Components check box.

    Shown is the Choose E A Server Profile screen. It allows you to select a profile containing the information necessary to connect to E A Server if you want to specify E A Server components for your page now. Visible are columns for Profile Name, Host Port, User, and Pass. At bottom is a selected check box labeled Skip E A Server components.

    You add EAServer information in the next lesson.

  7. Click Next.

    Click Finish.

    The wizard creates the new Web page and the page opens in Page view. The filename is Welcome.jsp.

  8. In Page view, select the default text Put your data here.

    Type Welcome to Sportswear Inc.

    In this tutorial, you make all changes to Web pages in Page view. Knowledge of HTML is required to make the same changes in Source view.

  9. Select File>Save from the menu bar to save the changes.

Change type face

It is easy to change the look of a Web page in the HTML editor.

  1. Place the cursor at the end of the text and press Enter.

    Place the cursor in the text Welcome to Sportswear Inc.

    Right-click and select Paragraph Properties from the drop-down list box.

  2. Click the Inline Styles tab.

    Select Inline and click the Edit button, then click the Font tab.

  3. Scroll through the Available Fonts list and select the Comic Sans MS font.

    Click the arrow button to move Comic Sans MS to the Selected Fonts list box.

  4. In Font Size click the Specific radio button.

    Type 20 and select pt (point size) from the box next to the Specific radio button.

    Select Red from the Color Selection drop-down list box.

  5. Click the Background tab, then click the Relative radio button.

    Select center from the drop-down list box under Horizontal and Vertical.

    Select Blue from the drop-down list box next to Background Color.

  6. Click OK twice.

    Your type face changes are applied to the text.

    Shown is the text "Welcome to Sportswear ,  Inc." in the colors selected.

    The paragraph tags display only if the Show Non-Visual Tags menu item is checked in the Page view pop-up menu. You access the pop-up menu by right-clicking the page in Page view.

  7. Select File>Save from the menu bar.

Add a graphic

Next you add an image file to the Welcome page.

  1. Right-click on the Customer target in the System Tree.

    Select New Folder from the pop-up menu.

  2. Type Graphics for the folder name and press Enter.

  3. Right-click on the Graphics folder and select Import Files.

    Select All Files from the Files of Type drop-down list box.

  4. Navigate to the Tutorial folder and select Image Files for the file type.

    Select tshirtw.jpg and click Open.

    The image file is copied to the Graphics folder.

  5. Click in the Welcome.jsp page.

    Place the cursor in the paragraph below the Welcome title.

    Press Enter to add more space below the title.

  6. Place the cursor again in the paragraph below the Welcome title.

    Select Insert >Image from the menu bar.

  7. Click the browse button (...) next to the Image Location text box.

  8. Open the Graphics folder on the Target page of the Choose URL dialog box.

  9. Select the filename tshirtw.jpg from the folder.

    Shown is the Target tab page of the Choose U R L dialog box. At top is a text box labeled U R L displaying Graphics / t shirt w dot j p g and a text box showing the Base Directory path. Below these is an area labeled Contents of Customer. Customer and Graphics are expanded to show the selected file name t shirt w dot j p g. At right is a button labeled Add File To Target. At bottom is a drop down labeled Files of Type with Image Files selected.
  10. Click OK in the Choose URL dialog box, and again in the Image Properties dialog box.

    The white T-shirt (tshirtw.jpg) image displays on the Welcome page.

Add absolute positioning to a graphic

Now you fix the image at a specific location on your page. Absolute positioning lets you fix where the graphic displays on the page regardless of screen size.

  1. Right-click on the T-shirt graphic. Select Position>Use Absolute Positioning from the pop-up menu.

  2. Drag the graphic below the heading, centering it under the blue bar.

    Shown is the text Welcome to Sportswear, Inc. with a graphic of a tee shirt centered below it.
  3. Click the Preview tab to view what the page looks like when deployed.

  4. Select File>Save from the menu bar.