value attribute is getting called twice when using extendedDataTable
himanshu.bhardwaj May 25, 2011 11:42 AMHi All,
Am trying to implement extendedDataTable but facing the issue that the value attribute is getting invoked twice, because of which the table data is getting duplicated. I am not able to figure whether I am doing it wrong or am I mssing anything.
Thanks
<code>
This is my javacode which is invoked:
public List<TestBean> getListBean() {
TestBean t1 = new TestBean();
t1.setId(1);
t1.setAge(10);
t1.setName("XXX");
TestBean t2 = new TestBean();
t2.setId(2);
t2.setAge(14);
t2.setName("YYY");
TestBean t3 = new TestBean();
t3.setId(3);
t3.setAge(15);
t3.setName("ZZZ");
listBean.add(t1);
listBean.add(t2);
listBean.add(t3);
return listBean;
}
/**
* @return the listAllBean
*/
public List<TestBean> getListAllBean() {
System.out.println("Query here will call the database code");
return getListBean();
}
This is my jsp:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
</ui:composition>
<html>
<f:view>
<h:form>
<%--<rich:datascroller for="testList" maxPages="100"/>--%>
<rich:spacer height="20" />
<rich:extendedDataTable id="testList" value="#{testGroupBean.listAllBean}" var="item">
<rich:column>
<f:facet name="header">
<h:outputText value="age" />
</f:facet>
<h:outputText value="#{item.age}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#{item.name}" />
</rich:column>
</rich:extendedDataTable>
</h:form>
</f:view>
</html>
</code>