Binding a JavaServer Faces multiple-selection component to an EGL page handler
A multiple-selection component allows a user to make one or more selections from a list of values. The user's selections are stored in a page-handler array data area. Check box groups and multiple-select list boxes are multiple-selection JavaServer Faces components.
A binding is a relationship between the component and a data area. The data area must be declared in the page handler before you can bind a component to it. A multiple-selection component needs two different kinds of bindings:
- A binding to one or more data areas that contain the values from which the user can make a selection
- A binding to an array data area that will receive the user's selections
To bind a JavaServer Faces multiple-selection component to existing EGL page-handler data areas, do as follows:
- Open a Faces JSP file in the Page Designer. If you do not have a JSP file open, double-click on the JSP file in the Project Explorer. The JSP opens in the Page Designer. Click the Design tab to access the Design view.
- From the Window menu, select Show View > Other >Basic > Palette.
- In the Palette view, click the Faces Components drawer to display the Faces Components object types.
- Drag a multiple-selection component from the palette to the JSP. The component object is placed on the JSP.
- To bind the component to one or more page-handler data areas that contain the values you want to display to the user, do one of the following procedures:
- You can bind the component to individual page-handler data areas, each of which contains one list item. Perform the following procedure for each data area:
- Select the object component on the JSP.
- In the Properties view, click Add Choice. The Name and Value fields are populated with default values.
- Click the Name field, then type the text that you want to display to the user.
- Click the Value field, then click the button next to the Value field. Select an individual data area from the Page Data Object list and click OK. This data area holds the value that will be moved to the receiving data area.
- You can bind the component to a page-handler array data area that contains the values you want to display to the user. Perform the following procedure to bind the component to an array data area:
- Select the object component on the JSP.
- In the Properties view, click Add Set of Choices. The Name and Value fields are populated with default values.
- Click the Value field, then click the button next to the Value field. Select an array data area from the Page Data Object list and click OK. The values in the array data area are the values that will be displayed to the user. The properties described later determine whether the values in the array data area or their equivalent index values will be moved to the receiving data area.
- If you are using an array data area to supply the values displayed to the user, define the receiving data area with two properties: selectFromList and selectType. The selectFromList property points to the array that holds the list items. The selectType property indicates whether the receiving data area is to be populated with a text value or an index value. Examples of receiving data areas are as follows:
colorSelected char(10) {selectFromList = colorsArray, selectType = value};colorSelectIdx smallInt {selectFromList = colorsArray, selectType = index};- To bind the component to a page-handler array data area that will receive the user's selections, do as follows:
- Select the component object on the JSP
- Click the button next to the Value field of the Properties view
- Select a data area from the Page Data Object list
- Click OK
Related concepts
PageHandler part
Related tasks
Creating an EGL pageHandler part
Related reference
Page Designer support for EGL
PageHandler part in EGL source format