Eis meu problema:
No xhtml abaixo (listaDeOSs.xhtml) quando coloco deste modo, ele não reconhece o método que fiz em meu Bean (o método do bean retorna uma lista). O JSF juntamente com o primefaces é mostrado na tela perfeitamente, só que não retornando os dados (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>
Abaixo a tela apresentada que não mostra os dados:
Em contrapartida, quando utilizo o jsf com html, o código reconhece o método do meu bean e consequentemente funciona (me retornando os dados). Só que fica feio, diferente do primefaces que é bonito.
Abaixo o meu bean:
package br.com.moriahitg.bean;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import br.com.moriahitg.dao.SZA990DAO;
/*import br.com.moriahitg.modelo.SA1990;*/
import br.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;
}
}
Meu faces-cofig abaixo:
<?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>
Meu 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>