h:selectManyListBox -- Balusc Your Help is Essential
Guys,
Interesting problem here. I have two list boxes and i want data to be populated from one list to the other by clicking on buttons. Something like an arrow button on click of which i remove data from one list box and add it to the other list box. Possible in JSF without using ValueChangeListener?
thanks,
Dilip
[342 byte] By [
dilip_jsfa] at [2007-11-27 7:01:35]

# 1
Yes it is....Possible using a action method or ActionListener used for the arrow mark(commandLink) which you gonna display....
<h:selectManyListBox value="#{managedBean.selectedItems}">
<f:selectItems value="#{managedBean.selectedItemsList}"/>
</h:selectManyListBox>
<h:commandLink action="#{managedBean.action}">
<h:graphicImage url="/images/arrow.gif" />
</h:commandLink>
<h:selectManyListBox value="#{managedBean.gotSelectedItems}">
<f:selectItems value="#{managedBean.gotSelectedItemsList}"/>
</h:selectManyListBox>
ManagedBean.java:
================
public class ManagedBean{
private Set<String> gotSelectedItemsList;
private List<SelectItem> gotSelectedItems;
private Set<String> selectedItemsList;
private List<SelectItem> selectedItems;
public String action(){
// manipulate this.gotSelectedItemsList,this. gotSelectedItems,this.selectedItemsList,this. selectedItems
-
-
-
-
return "reload";
}
//getters and setters for the specified properties
-
-
}
faces-config.xml:
==============
<navigation-rule>
<from-view-id>/xyz.jspx</from-view-id>
<navigation-case>
<from-outcome>reload</from-outcome>
<to-view-id>/xyz.jspx</to-view-id>
</navigation-case>
</navigation-rule>