Page Designer support for EGL
When you create a JSP file in an EGL Web project, EGL automatically creates a page handler, and that page handler includes skeletal EGL code for you to customize. Then, in Page Designer, do as follows:
- Drag components from the palette to a JSP
- Use the Attributes view to set component-specific characteristics such as color and to set up bindings, which are relationships between components and either data or logic
You can do work that is specific to EGL:
- Create EGL variables and place them in an existing page handler.
- Bind page-handler items to JSP user-interface components.
- Bind page-handler functions to buttons and hyperlink controls. The functions act as event handlers.
When you use the source tab in Page Designer, you can manually bind components in a JSP file (specifically, in a JavaServer Faces file) to data areas and functions in a page handler. Although EGL is not case sensitive, EGL names referenced in the JSP file must have the same case as the EGL variable or function declaration; and if you fail to maintain an exact match, a JavaServer Faces error occurs. It is recommended that you avoid changing the case of an EGL variable or function after you bind that variable or function to a JSP field.
For further details on naming issues, see Changes to EGL identifiers in JSP files and generated Java beans.
Binding components to data areas in the page handler
Most components on the JSP have a one-to-one correspondence with data. A text box, for example, shows the content of the EGL item to which the text box is bound. An input text box also updates the EGL item if the user changes the data.
A more complex situation occurs when you are specifying a check box group, list box, radio button group, or combo box. In those cases, you need two different kinds of bindings:
- One is to bind the component to the text that you want to display to the user. An example is the text of an item in a list box.
- One is to bind the component to a page-handler data area that receives a value to indicate the user's choice. You might create a data item, for example, to receive the numeric index of a user-selected list-box item.
In the Properties view, you can follow either of two procedures to bind the component to the text that the user sees:
- You can use Add Choice to indicate that the component is associated with a single character string, which may be specified explicitly or by identifying a page-handler item
- You can use Add Set of Choices to indicate that the component is associated with a list of character strings, which may be specified explicitly or by identifying a page-handler area such as a data table or an array of character items
Alternatively, you can bind a single-select component (combo box, single-select list box, or radio button group) to an array of character items by dragging the array from the Page Data view to the component.
To bind a component to a data area that will receive a value indicating the user's choice, you can work in either the Page Data view or the Properties view. The procedure is the same as when you are binding any component, even a simple text box.
If the value can be only one of two alternatives, you can bind the component to an EGL item for which the item property boolean is set to yes. The component populates the item with one of two values:
- For a character item, the value is Y (for yes) or N (for no)
- For a numeric item, the value is 1 (for yes) or 0 (for no)
When a check box is displayed, the status (whether checked or not) is dependent on the value in the bound item.
For details on the properties that can be applied to data items in the page handler, see Page item properties.
Binding components to functions
After you drag a command button or a command hyperlink to the page surface, you can bind that component to an existing EGL function or to an event handler that the Page Designer creates:
- You can bind the component to an existing event handler in any of these ways--
- By dragging the EGL function from the Actions node in the Page Data view to the component, as is recommended
- By opening the component in the Quick Edit view
- By right-clicking on the component and selecting Edit Faces Command Event
- You can cause Page Designer to create a new event handler either when you open the component in the Quick Edit view or when you right-click on the component and select Edit Faces Command Event
If the Page Designer creates an event handler in the page handler and gives you access to that page-handler function, the name of the function is the tool-assigned button ID plus the string "Action". If the name is not unique to the page handler, the Page Designer appends a number to the function name.
Related concepts
PageHandler partRelated tasks
Creating an EGL data item and associating it with a Faces JSP
Associating an EGL record with a Faces JSP
Using the Quick Edit view for page-handler code
Related reference
PageHandler part in EGL source format
Page item properties