How to assign value to object array in richfaces
olasamuel Aug 17, 2010 7:35 AMHi All,
I have a been which looks like this
private void _Initialize(String query, String[] restrictions) {
// Set the query and restrictions to use
this.setEjbql(query);
this.setRestrictionExpressionStrings(Arrays.asList(restrictions));
this.setOrder(ORDER); //Override the getOrder in the EntityQuery
this.setMaxResults(2500);
getDistinctTopic();
public List<Object[]> getDistinctTopic() {
distinctTopic = this.getEntityManager().createQuery(QUERY_DINSTICT_TOPIC).getResultList();
return distinctTopic;
}
in my view.xhtml I want to display the value of distinctTopic which is a list object array
I have been struggling to do this but I dont get how to assign the value. All I have tried are not working. Can someone please help me.
This is my view.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
template="layout/template.xhtml">
<ui:define name="body">
<rich:panel>
<f:facet name="header">Voting Results</f:facet>
<div>
<h:outputText value="No vote exists"
rendered="#{empty distinctTopic}"/>
<rich:dataTable id="voteList" var="myTopic"
value="#{distinctTopic}"
rendered="#{not empty distinctTopic}">
<rich:column>
<f:facet name="header">Topic</f:facet>
<!--<s:link value="#{myTopic.toString()}" view="/voteResult.xhtml" /-->
#{distinctTopic.toArray(a)}
</rich:column>
</rich:dataTable>
</div>
</rich:panel>
<!--<div>
<s:button id="done"
value="Create vote"
view="/vote.xhtml"/>
</div>-->
</ui:define>
</ui:composition>