i cannot find out what i am doing wrong, so that my dataTable is not shown on the webpage.
The User class i created is not really complicated but has more than these three properties which i try to set in the bean.
The only thing that is displayed is the facet Text "Test Header"
What am i missing?
Testmonitor .xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<head>
<title>Test Monitor</title>
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
</head>
<body onload="#{testdata.createUsers()}">
<p:dataTable id="overviewTable" var="collector" sortOrder="descending" value="#{testdata.userList}">
<f:facet name="header">
Test Header
</f:facet>
<p:column headerText="IP">
<h:outputText value="#{collector.ip}" />
</p:column>
<p:column headerText="CollectorID">
<h:outputText value="#{collector.collectorId}" />
</p:column>
<p:column headerText="ID">
<h:outputText value="#{collector.id}" />
</p:column>
</p:dataTable>
</body>
</html>
Bean:Testdata.java
package MonitorTest;
import UserAndPosition.User;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.util.List;
@ManagedBean
@SessionScoped
public class Testdata {
private List<User> UserList;
private User aUser=new User();
public void createUsers() {
aUser.setCollectorId("AnyCollectorID");
aUser.setId("WND9L320NDUD");
aUser.setIp("192.168.2.1");
UserList.add(aUser);
//System.out.println("Post Construct durchgelaufen");
}
/**
* Regular Getter- and Setter Methods.
*/
public Testdata() {
}
public List<User> getUserList() {
return UserList;
}
public void setUserList(List<User> UserList) {
this.UserList = UserList;
}
}
Thanks in advance