Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamically Populating a Multiple Selection List Box

Similar presentations


Presentation on theme: "Dynamically Populating a Multiple Selection List Box"— Presentation transcript:

1 Dynamically Populating a Multiple Selection List Box
This Learning Module shows how to use EGL to dynamically populate a Multi-Selection List Box.

2 Dynamically Constructed Selection Controls
In this lab, we will learn how to populate a Multiple Selection List directly from server-side information.  Here’s how you will do this: Starting on the next slide (steps begin on the next slide), you’ll create a new page. Then you will create a JSFHandler that contains an array populated from the database The array will have additional “annotations” (properties) that “hook into” the JSF Selection controls You will add a JSF component to the page Then you will bind the data to the component Note – you must be at RBDe version in order to successfully complete this lab

3  Dynamically Constructed Selection Controls – JSFHandler
Create a new .jsp web page named: dynSelection_multiSelection.jsp Using the code in the Notes section of the document, (Copy/Paste and) replace the existing default JSFHandler code. Note the following: In the array record definitions there are new properties that bind server-side data directly to JSF controls: {selectedValueItem = <var> This properties specifies which: Single field receives the result of a single selection control @SelectionList – a property “annotation” that points to: labelItem = <var> Specifies which field – FROM THE ARRAY RECORD – will be used to display selection values valueItem = <var> Specifies which field – FROM THE ARRAY RECORD – will be used to return the selected values package jsfhandlers; import com.ibm.egl.jsf.UIViewRoot; import egl.ui.selectedvalueitem; import egl.ui.selectionlist; import eglderbyr7.data.Statetable; handler dynSelection_multiSelection type JSFHandler {onConstructionFunction = onConstruction, view = "dynSelection_multiSelection.jsp", viewRootVar = viewRoot} viewRoot UIViewRoot; statesML Statetable[0] {selectedValueItem = selectedChoiceML, @SelectionList {labelItem = StateName, valueItem = StateAbbrev}}; selectedChoiceML string[10]; // Function Declarations function onConstruction() get statesML with #sql{ select EGL.STATETABLE.STATE_ABBREV, EGL.STATETABLE.STATE_NAME from EGL.STATETABLE where EGL.STATETABLE.STATE_NAME <= 'Georgia' order by EGL.STATETABLE.STATE_ABBREV asc }; end

4  Dynamically Constructed Selection Controls – Page and Layout
Drag a new List Box – Multi Select control onto the page inside of the left column of a two columned HTML Table Bind the statesML array to the new control Drag the selectedChoiceML – string control onto the page Drag a command button onto the page

5  Run on Server Note that the Multiple Selection List Box was populated with dynamic data pulled from the database.


Download ppt "Dynamically Populating a Multiple Selection List Box"

Similar presentations


Ads by Google