IListRowSet interface
IListRowSet is an extension to the javax.sql.RowSet interface that provides the methods necessary to populate a listbox in a JSP. Although anyone developing a NAS application can use IListRowSet, this interface is typically used in components generated by Netscape Application Builder.
IListRowSet replaces the IListDataSet interface from NAB 3.0.
Package
com.netscape.server.servlet.extension
Methods
Related Topics
com.netscape.server.servlet.extension.IRowSet2 interface, javax.sql.RowSet interface
addListItem( )
Adds an item to a list.
Syntax
public abstract void addListItem(String label, String value)
label.
The label for the list entry; this is not necessarily the name of the item as it appears in the list.
value.
The value assigned to the label.
Usage
Use addListItem( ) with setListSelection( ) when working with an IListRowSet to create a selection list or a group of radio buttons.
Example
The following code fragment creates a data set as a list:
IListRowSet ds = BaseUtils.createListRowSet(request,response,"myList");
ds.addListItem("Star Trek", "1");
ds.addListItem("Babylon 5", "2");
ds.addListItem("Red Dwarf", "3");
ds.addListItem("Crusade", "4");
ds.setListSelection("2"); // Babylon 5 is the default selection
To display this list on a web page, you might create a JSP containing the following code:
<SELECT NAME="TVShow">
%gx type=tile id=myList%
<OPTION VALUE="%gx type=cell id=myList.value% %/gx%"
%gx
type=cell
id=myList.isEqualToExpression(
myList.value=myList.ListSelection)%SELECTED
%/gx%
>
%gx type=cell id=myList.label%%/gx%
%/gx%
</SELECT>
setListSelection( )
Sets the item that appears as the default selection in a list.
Syntax
public abstract void setListSelection(String value)
value.
The value (not the label) in the list that appears as the default selection.
Usage
Use setListSelection( ) with addListItem( ) when working with data sets to create a selection list or a group of radio buttons.
|