rich:listShuttle - is it limited to Collections of Strings?
konstandinos Feb 2, 2008 11:43 AMHi
I have successfully gotten listShuttle working when passing in an ArrayList for both sourceValue and targetValue.
However what I need is to be able to pass it a List of beans, for example: ArrayList.
I have tested this and it almost works.
Let's say that MyBean has two instance variables, int id and String label.
Now when I set my listShuttle's source and target values to be of type #{backingBean.arrayListOfMyBeansSource} and #{backingBean.arrayListOfMyBeansTarget}, I then can set the listShuttle's var attribute to be "myBean".
Then in my listShuttle's nested richColumn's outputText value I have "myBean.label"
This works so far as in it displays the lists correctly (using the labels of all the MyBeans contained in each ArrayList).
However when I try submit the form the program bombs out with the following error:
'#{myBean.label}' Property 'label' not found on type java.lang.String
I am not sure what this means.
What confuses me is that the lists are both displayed just fine, as in, both of the ArrayList are traversed and each myBean.label is printed in the corresponding list.
Please advise as to whether I can indeed pass in an ArrayList - I need this functionality. If it is doable, how do I go about a) avoiding that error I pasted above, and b) how do I update the backing bean's value to contain the new ArrayList from the listShuttle's targetValue?
Thanks very much for your help.
Ps, my JSF code is below:
<rich:listShuttle sourceValue="#{contactController.availableGroups}" targetValue="#{contactController.currentGroups}" var="group" listsHeight="300" switchByClick="true" controlsType="none" sourceCaptionLabel="Available groups" targetCaptionLabel="#{contactController.contact.nameFirst}'s current groups"> <rich:column> <h:outputText value="#{group.name}"></h:outputText> </rich:column> </rich:listShuttle>
As you can see, the MyBean is basically a Group bean, which contains a group name, (the label I was talking about above), group description and group id (for uniquely identifying the group in the database).
For what it's worth, here is the actual error:
javax.servlet.ServletException: /contacts/update.jsp(427,5) '#{group.name}' Property 'name' not found on type java.lang.String javax.faces.webapp.FacesServlet.service(FacesServlet.java:256) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Any help would be greatly appreciated.
Thanks,
Konstandinos