0

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;
}
...
Ace
  • 821
  • 3
  • 16
  • 37

1 Answers1

3

Your inputHidden has a List<String> as value, not a String. You need a converter to do that.

Esteve
  • 1,789
  • 18
  • 23
  • I've added a converter like [link](http://stackoverflow.com/questions/14594927/how-to-pass-a-list-of-string-as-hidden-input-from-a-jsf-page-to-a-request-scoped) . And sure the error is gone, but the bookName is never thrown into the list. – Ace Sep 13 '13 at 20:13
  • Well looking back on it, I think the issue now is a JavaScript one. Thanks for the help! – Ace Sep 13 '13 at 20:25