Problem with listShuttle
kash_meu May 13, 2009 4:16 AMPlease help me. I am getting this error message.
"Component my_form:shuttle has invalid value expression eu.digitania.admingui.beans.Content@12c55e4"
Here is my code.
shuttle_demo.jsp
<f:view> <h:form id="my_form"> <h:messages></h:messages> <rich:listShuttle id="shuttle" sourceValue="#{contentBean.allContent}" converter="listShuttleConverter" var="content" listsHeight="200" sourceListWidth="200" targetValue="#{contentBean.targetSelection}"> <rich:column> <h:outputText value="#{content.contentId}"></h:outputText> </rich:column> <rich:column> <h:outputText value="#{content.title}"></h:outputText> </rich:column> </rich:listShuttle> <br /> <br /> <h:commandButton value="Process" action="#{contentBean.submitShuttle}"></h:commandButton> </h:form> </f:view>
ContentBackingBean
public class ContentBackingBean extends Content
{
private Set targetSelection;
public List getAllContent()
{
ContentDAOImpl contentDAOImpl = new ContentDAOImpl(MobileContentPortalDao.getSqlMapper());
List contentList = null;
try
{
contentList=contentDAOImpl.getAllContentByContenttype(6);
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return contentList;
}
public String submitShuttle()
{
System.out.println("\n\n\n\n\n"+this.targetSelection.size()+"\n\n\n\n");
return "success";
}
public void setTargetSelection(Set targetSelection)
{
this.targetSelection = targetSelection;
}
public Set getTargetSelection()
{
return targetSelection;
}
}
converter
public class ListShuttleConverter implements Converter { @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Content content = new Content(); content.setTitle(value); System.out.println("Returning Content"); return content; } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { Content content= (Content)value; System.out.println("Returning Title"); return content.getTitle(); } }