I have a selectManyListbox where users can make
multiple selections. The listbox is coded this way:
[code]
<h:selectManyListbox
value="#{fileManagementBean.dataFile}" >
<f:selectItems
value="#{fileManagementBean.dataFileItems}"/>
</h:selectManyListbox>
[/code]
The "dataFileItems" is a List of SelectItem objects
and the "dataFile" is a String array.
Users may change their mind about the selections made
before they submit the form; therefore, I provide the
form with a "Clear Selections" button with an
actionListener, and I code this way:
[code]
<h:commandButton value="Clear Selections"
type="submit"
actionListener="#{fileManagementBean.clearMultipleSelections}"
immediate="true"/>
[/code]
In the backing bean, I tried to set the
setSubmittedValue, but could not get it right. Here
is the clearMultipleSelections method in my backing
bean:
[code]
public void clearMultipleSelections( ActionEvent event
)
{
int length = dataFile.length;
for( int i = 0; i < length; i++ )
{
dataFile[i].setSubmittedValue( null );
}
}
[/code]
See, the dataFile[i] is a String and the
setSubmittedValue method is undefined for the type
String.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com