It is also assumed that a network connection can be made to the publicly accessible IBM Demonstration iSeries host at:
Host name: iseriesd.dfw.ibm.com, port: 23, type: 5250
Connectivity to this host can be tested by using any TN5250 emulator configured for the settings above. A WebSphere application server that meets the requirements for HATS needs to be available if you want to deploy the HATS application to a production WebSphere server. It is assumed that you are already familiar with the WebSphere application server console.
1. Launch the HATS Studio
3. The New Project panel will come up.
5. On the Connection Settings panel enter the following:
1. With the project highlighted in the HATS Project View, click on the
terminal icon from
the toolbar. This will open the terminal window.
2. The initial screen should be the Sign On screen.
3. Press the "Create a HATS Screen Customization" icon from
the terminal toolbar.
4. In the "Create a Screen Customization", enter "SignOn" for the name
and press "Next".
5. Leave the selected Screen Recognition Criteria for the second wizard panel, and press "Next".
6. Select "Use existing transformation" with value of "default.jsp" checked, and check the "Add advanced action" check box, and press "Next".
7. Press the "Add" button on the "Advanced Actions" panel.
8. For the Action, select "Extract a global variable".
9. For the Name, enter "Display".
10. Draw a box over the Display ID to the right of the "Display . . . . :" text. Select OK.
11. Press the "Add" button again on the Advanced Actions panel.
12. Select the "Set a Global Variable" drop down.
13. Enter "localtime" for the variable name.
14. Press the "Set to a fixed value" radio button.
15. Enter 0 for the initial value. We will be updating this value using business logic in the next section. Press the OK button.
16. Press the Finish button in the "Create a Screen Customization" wizard.
2. For the class name, enter LocalTime. For the package name, enter com.education.hats and press the Finish button.
3. You will see "LocalTime.java" open in the java editor with these contents:
5. Press Ctrl+S to save the java code. You should see no errors appear in the task list. When you save java files under WS/AD, it automatically compiles the code and places the associated class files in the appropriate directory for this WebApplication.
2. Logon to the first screen
3. Enter boats
4. Press Enter at the BOAT demo menu.
5. On the AS/400 WSG Boat Demo menu, press the customize icon.
6. Enter boatsdemo for the customization.
7. Press Next
8. Let the screen recognition criteria default, and press next.
9. Select to create a new transformation, boatsdemo.jsp
10. Select the "Add advanced actions" check box and press Next.
11. On the "Advanced Actions" dialog, press the Add button.
12. For the "Java package" entry field, press the "Browse..." Button and select com.education.hats
13. For the Class name entry field, enter LocalTime
14. For the method name, enter execute
15. Press the OK button
16. Press the Finish button on the "Create a Screen Customization" panel.
17. In the .jsp editor for the transformation, boatsdemo.jsp, select
the Insert HATS component toolbar item .
18. Draw a box around the table of data in the "Screen Region" panel
and press Next.
19. Leave the Default component and widget selected.
20. Press the Finish button.
21. In the source view of the boatsdemo.jsp editor, after the HATS:Component tag, enter the text for a line break <BR>
22. Place the cursor after the <BR> statement.
23. Select the drop down item of the Insert HATS component toolbar item, and
select Insert Global Variable...
24. For the Name drop down, select the value localtime and press
OK
25. Press Ctrl+S to save boatsdemo.jsp.
3. Select the WebSphere v4.0 Test Environment server (the only one)
and press the Restart icon on
the title bar of the Servers window.
4. Wait for the text "Server
Default Server open for e-business" to appear in the
Console window.
5. If there is a Web Browser window open, close it.
6. Right click on the HATS project you created in the navigator window and click on the choice "Run on Server"
7. When the main menu screen appears, enter USER4BOATS for the User, password for the password, and press Enter.
8. If the main menu screen doesn't appear, press Enter.
9. See the modified screen with the new "View Boats" button.
Conclusion
In this tutorial you were shown how to use HATS business logic and global variables.