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", use the prefilled name for
the new screen customization (SignOn) and press "Next".
5. Leave the selected Screen Recognition Criteria for the second wizard panel, and press "Next".
6. The Select Actions panel will be next, leave the defaults, Apply a transformation checked, and the Create new transformation checked. Check the "Add advanced action" check box, and press "Next".
7. On the Advanced Actions panel, press the "Add" button.
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. Click OK.
11. Press the "Add" button again on the Advanced Actions panel.
12. Select the "Set 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. Highlight "Set a global variable" in the type list, and then click the Up button twice so that the "Set global variable" type is the first item in the list of actions and the Extract a global variable is in the middle and then the Apply a Transformation is last.
17. Press the Finish button in the "Create a Screen Customization" wizard.
18. The Screen Region panel will open now. With the mouse, draw a box around the entire Userid and Password input fields on the host screen, including the names for the fields and click Next.
19. On the Rendering Option panel, select Input field for the Component and Text input for the Widget and click Finish.
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 when using WSAD, it automatically compiles the code and places the associated class files in the appropriate directory for this WebApplication.
2. Logon to the first SignOn screen and press ENTER. If you get the display messages screen just press the ENTER key.
3. On the next screen enter boats on the command line and press ENTER.
4. Press Enter at the AS/400 WSG BOATS screen which will have the A by default for the type and move to the next screen showing the first screen of the results list.
5. On this screen, the AS/400 WSG Boat Demo results screen, press
the Create HATS Screen Customization icon.
6. Use the prefilled name for the screen customization.
7. Press Next
8. Let the screen recognition criteria default, and press next.
9. The Select Actions panel will be next, leave the defaults, Apply a transformation checked, and the Create new transformation checked. Check the "Add advanced action" check box, and press "Next".
10. Select the "Add advanced actions" check box and press Next.
11. On the "Advanced Actions" dialog, press the Add button.
12. For the Action select "Execute business logic" from the drop down selection list. For the Class name field, press the "Browse..." Button and highlight com.education.hats.LocalTime from the Select Class panel and then click OK.
13. For the method name, execute should be in the window.
14. Press the OK button. Back on the Advanced Actions panel highlight the "Execute a Java method" and click the Up button to move it to the top position in the list. So you should now have the Execute a Java method at the top and the Apply a Transformation last.
15. Press the Finish button on the "Create a Screen Customization" panel.
16. You should now be on the Insert HATS component - Screen Region
panel.
.
17. Draw a box around the table of data in the "Screen Region" dialog
box or any other text on the screen to render out some text results on
this screen and press Next.
18. Leave the Default component and widget selected.
19. Press the Finish button.
20. In the source view for "As_400WsgBoatDemo.jsp" in the HTML editor, enter the text for a line break <BR> after the HATS:Component tag. See step 27 below for the exact location.
21. Place the cursor after the <BR> statement.
22. On the Tool bar, click on the HATS Tools and select the drop down item to Insert Global Variable...
23. From the Name drop down list, select the value localtime variable and press OK. The JSP tag will be enterred with the code to display the localtime variable.
24. Enter another line break <BR> on the line just below the previous one.
25. Place the cursor after this <BR> statement. From the Tool bar at the top, click on HATS Tools and select the item: Insert Global Variable...
26. From the Name drop down list, select the value display and press OK. The JSP tag will be enterred with the code to display the display ID variable.
27. The code on the As_400WsgBoatDemo.jsp should look like this
below on the As_400WsgBoatDemo.jsp
<HATS:Form>
<HATS:Component type="com.ibm.hats.component.DefaultExtract"
widget="com.ibm.hats.widget.DefaultWidget" row="10" col="6" erow="20" ecol="77"
label="" componentSettings="" widgetSettings="" />
<br><%= ((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).getGlobalVariable("localtime",
true).getString() %>
<br><%= ((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).getGlobalVariable("display",
true).getString() %>
<HATS:HostKeypad/>
</HATS:Form>
28. Press Ctrl+S to save the As_400WsgBoatDemo.jsp.
3. Select the WebSphere v5.0 Test Environment server 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. Navigate through the application with the defaults. Leave the A selected for the type of boat and press the enter key.
9. You should now see the AS/400 WSG Boat Demo results screen rendered in the browser with the transformation applied and the current time and display ID displayed at the bottom of the boats list. This confirms that your business logic executed properly and displayed the results from global variables.
Conclusion
In this tutorial you were shown how to use HATS business logic and global variables.
Copyright: Licensed Materials - Property of IBM
(C) Copyright IBM Corp. 2002 All rights reserved.
U.S. Government Users Restricted Rights -
Use, duplication or disclosure restricted by
GSA ADP Schedule Contract with IBM Corp.