Boa tarde caros amigos, gostaria de saber porque meu datatable aparece vazio.
classe User:
/**
*
*/
package br.com.teste.ManagedBean;
/**
* @author euclides
*
*/
public class User implements java.io.Serializable {
private String name;
private String address;
private int age;
private static final long serialVersionUID = 1L;
public User() {
}
public User(String name, String address, int age) {
super();
this.name = name;
this.address = address;
this.age = age;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address
* the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the age
*/
public int getAge() {
return age;
}
/**
* @param age
* the age to set
*/
public void setAge(int age) {
this.age = age;
}
}
o BackBean.
/**
*
*/
package br.com.teste.ManagedBean;
import java.util.LinkedList;
import java.util.List;
/**
* @author euclides
*
*/
public class TheSecondManagedBean {
private List<User> listaUsuario;
public TheSecondManagedBean(){
listaUsuario = new LinkedList<User>();
listaUsuario.add(new User("euclides","rua braz de francesco",23));
listaUsuario.add(new User("bruno","av. bezerra de meneses",65));
listaUsuario.add(new User("Alzira","rua dona leopoldina",35));
}
/**
* @return the listaUsuario
*/
public List<User> getListaUsuario() {
return listaUsuario;
}
/**
* @param listaUsuario the listaUsuario to set
*/
public void setListaUsuario(List<User> listaUsuario) {
this.listaUsuario = listaUsuario;
}
}
e minha pagina de teste.
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view>
<h:form>
<h:outputText value="Lista de Usuarios" />
<h:dataTable var="user" value="#{theSecondManagedBean.listaUsuario}">
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#{user.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="address" />
</f:facet>
<h:outputText value="#{user.address}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="age" />
</f:facet>
<h:outputText value="#{user.age}" />
</h:column>
</h:dataTable>
</h:form>
</f:view>
</html>
… Abraços.