SEAM, JSF 2 environment, I have a list of Strings that I would like to add to from a look up (and then have some business logic afterwards).
*I know that you usually require a converter for listboxes that have custom objects, but my objects are Strings, and should already have a compareTo() method. And yes, I know I am missing 'value' in h:outputLabel, but I have no need for the selected bookName, but ratehr the whole list to me is important.
...
function selectBook(bookId, bookName) {
var idInput = [];
var idInput = jQuery("#bookForm\\:bookNames");
idInput.push(bookName);
}
...
...
<h:panelGroup id="booksField">
<h:outputLabel for="booksListBox" value="Books:"/>
<h:selectOneListbox id="booksListBox" >
<s:selectItems var="_var" value="#{bean.searchCriteria.bookNames}" noSelectionLabel=""/>
</h:selectOneListbox>
<h:inputHidden id="bookNames" value="#{bean.searchCriteria.bookNames}" converter="StringListConverter"/>
</h:panelGroup>
...
And my Java code...
...
private List<String> bookNames;
public List<String> getBookNames() {
return bookNames;
}
public void setBookNames(List<String> bookNames) {
this.bookNames = bookNames;
}
...
Your inputHidden
has a List<String>
as value, not a String. You need a converter to do that.