Here's my problem:
In the xhtml below (list.xhtml) when I put it this way, it does not recognize the method I did in my Bean (the bean method returns a list). The JSF together with the primefaces is shown on the screen perfectly, only not returning the data (No records found).
<?xml version="1.0" encoding="UTF-8"?>
<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">
<h:head>
</h:head>
<h:body>
<h:form>
<p:commandButton value="Listar" actionListener="#{MBean.retornaOSsPorCliente}" styleClass="ui-priority-primary" />
<p:dataTable var="sza" value="#{MBean.list}">
<p:column headerText="Cliente">
<h:outputText value="#{sza.ZA_CLIENTE}" />
</p:column>
<p:column headerText="Funcionário">
<h:outputText value="#{sza.ZA_CODFUN}" />
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
Below the screen that does not show the data:
Incontrast,whenIusejsfwithhtml,thecoderecognizesthemethodofmybeanandthereforeworks(returningthedata).Itjustlooksugly,differentfromtheprimefacesthatit'sbeautiful.
Belowmybean:
packagebr.com.moriahitg.bean;importjava.util.ArrayList;importjava.util.List;importjavax.faces.bean.ManagedBean;importjavax.faces.bean.SessionScoped;importbr.com.moriahitg.dao.SZA990DAO;/*importbr.com.moriahitg.modelo.SA1990;*/importbr.com.moriahitg.modelo.SZA990;@ManagedBean(name="MBean")
@SessionScoped
public class MBean implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
List<SZA990> list = new ArrayList<SZA990>();
public SZA990 sza;
@SuppressWarnings("unchecked")
public List<SZA990> retornaOSsPorCliente () {
SZA990DAO szadao = new SZA990DAO();
list = szadao.getOSPorCliente("000002");
return list;
}
/*
public Iterator retornaOSsPorCliente (SA1990 sa1) {
SZA990DAO szadao = new SZA990DAO();
list = szadao.getOSPorCliente(sa1.getA1_COD());
Iterator it = list.iterator();
return it;
}
*/
public List<SZA990> getList() {
return list;
}
public void setList(List<SZA990> list) {
this.list = list;
}
public SZA990 getSza() {
return sza;
}
public void setSza(SZA990 sza) {
this.sza = sza;
}
}
My faces-cofig below:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<managed-bean>
<managed-bean-name>MBean</managed-bean-name>
<managed-bean-class>br.com.moriahitg.bean.MBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>t.xhtml</welcome-file>
</welcome-file-list>
</web-app>