index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:form>
<p:outputLabel value="Primefaces Tutorial"></p:outputLabel>
<p:dataTable value="#{Liste.dizgi}" var="liste">
<p:column>
<f:facet name="header">
<h:outputText value="Agent_code"></h:outputText>
</f:facet>
<h:outputText value="#{liste.Agent_code}"></h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Date"></h:outputText>
</f:facet>
<h:outputText value="#{liste.date}"></h:outputText>
</p:column>
</p:dataTable>
</h:form>
</html>
Liste.java
package pro;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.ManagedBean;
import javax.annotation.PostConstruct;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class Liste {
private List<Veri> dizgi=new ArrayList<Veri>();
public List<Veri> getDizgi() {
return dizgi;
}
public void setDizgi(List<Veri> d) {
this.dizgi = d;
}
public Liste(){};
@PostConstruct
void Listele(){
dizgi.add(new Veri("B-8821083","20150513",-1,-29));
dizgi.add(new Veri("B-8821083","20150521",46,4.718));
dizgi.add(new Veri("B-8821083","20150602",-5,-455));
dizgi.add(new Veri("B-8821083","20150623",-4,-305));
dizgi.add(new Veri("B-8821083","20150506",7,0));
dizgi.add(new Veri("B-8821083","20150612",1,0));
dizgi.add(new Veri("B-8821083","20150615",50,4.602));
}
}
Here is the code,when I run this code.It says
No records found.
What is the problem here? I tried to print List two attributes as columns.It gives no error.Just no records found is showed.But actually lots of elements exist. There is a veri class. it provides attributes such as Agent_Code and date and getter and setter methods etc.