Hi,
I've some problems using the woodstock listbox component in my app
(getting the selected value from the listbox).
First of all some code:
<code>
/**
* Holds value of property usersOptions.
*/
private List<Option> usersOptions = null;
/**
* Holds value of property usersSelectedOption.
*/
private Benutzer usersSelectedOption = null;
</code>
And the corresponding getter/setters:
<code>
/**
* @return the usersSelectedOption
*/
public final String getUsersSelectedOption() {
return usersSelectedOption;
}
/**
* @param usersSelectedOption
* the usersSelectedOption to set
*/
public final void setUsersSelectedOption(final String
usersSelectedOption) {
this.usersSelectedOption = usersSelectedOption;
}
</code>
A code snippet from the jsf:
<code>
<webuijsf:script>
function submitList() {
var domNode =
document.getElementById('form:manageUsersContentPage:usersListbox');
return domNode.submit(); // asynchronously submit list
}
</webuijsf:script>
<webuijsf:listbox id="usersListbox"
items="#{ManageUsersBean.usersOptions}"
onChange="submitList()" multiple="false" immediate="true"
selected="#{ManageUsersBean.usersSelectedOption}">
<f:facet name="label">
<webuijsf:label id="usersListBoxLabel" for="usersListbox"
text="#{bundle.manageUsers_listbox_users}"/>
</f:facet>
</webuijsf:listbox>
</code>
When selecting an item from the listbox an asynchronous request/response
is submitted serverside but the value of the selected item (which is an
instance of a "Benutzer" object) is not transmitted (the corresponding
setter is not called, therefore "usersSelectedOption" is still null) - I
figured out that when changing the "usersSelectedOption" to a String
object the corresponding setter is called.
Is this a bug or can anyone explain this behavior to me?
Any help would be greatly appreciated.
Best regards,
- Stephan