Java Reference
In-Depth Information
<webuijsf:tableColumn headerText="Email Address"
id="tableColumn4" sort="email">
<webuijsf:staticText id="staticText5"
<webuijsf:tableColumn id="tableColumn6" width="200">
<webuijsf:button id="button1" text="Update"/>
As we can see, the <webuijsf:table> tag has a nested <webuijsf:rowGroup>
tag; this tag is used to control the rows in our table. Notice that the sourceVar
attribute of <webuijsf:rowGroup> is automatically set to currentRow . Rows in a
table are generated dynamically from a data provider (in our case, we are using
the customerArray property of the SessionBean1 managed bean). While iterating
through the elements in the data provider, the current element is stored in this
variable ( currentRow ). We need to use this attribute in order to obtain the selected
elements in the table.
In order to keep track of, which rows are selected in our table, we need to create an
instance of com.sun.webui.jsf.event.TableSelectPhaseListener . This class has
two methods, getSelected() and setSelected() , that we need to use in order to
keep track of which rows are selected. Since we are using checkboxes to select rows,
we need to link the selected attribute of the checkbox to these methods. In order to
do this, we need to add two methods to our managed bean.
public void setSelected(Boolean selected) {
RowKey rowKey = (RowKey) getValue("#{currentRow.tableRow}");
if (rowKey != null) {
tableSelectPhaseListener.setSelected(rowKey, selected);
All managed beans generated in a visual web JSF project extend com.sun.rave.web.
ui.appbase.FacesBean , either directly or by extending one of its subclasses. This
class contains a convenience method called getValue() . This method takes a String
containing a Unified Expression Language ( UEL ) expression, and returns the object
to which the expression is bound.
Search WWH ::

Custom Search