Writing scripts to access EAServer components

4GL JSP pages provide ready access to EAServer components from server scripts. You can drag and drop a method for an EAServer component into a script or access a variable for an EAServer component.

Adding EAServer methods to server scripts

You can drag any component method visible in the System Tree to a server script.

The following illustration shows the result of dragging the getInfo method of the Artist component to the integrated Script editor in the script for the BeforeGenerate server-side event. The method is called when the BeforeGenerate event is triggered for the page.

Shown is a drop down list box at left with window selected, then a drop down list with the entry Before Generate ( ),  then a drop down list box for Java Script. In the Script area below is the line Artist dot get Info ( ) ;.

If you drag and drop a method that requires arguments, you simply type the arguments in the Script editor.

For how to set up access to an EAServer server to view components and component methods installed on a server, see “Working with EAServer components”.

Manipulating variables that represent EAServer components

Scripts can also access EAServer components represented as variables on your page. Whenever you drag an EAServer component from the System Tree and drop it on your page, the component is available as a variable. The variable name is the same as the component name unless you change it.

StepsTo view the EAServer variables for your page:

  1. Right-click in a 4GL JSP page open in the HTML editor, then select Page Properties from the pop-up menu.

  2. In the Page Properties dialog box, click the EAServer tab.

    On the EAServer page, you see the list of EAServer components and the associated variables.