primefaces数据表不显示任何内容 [英] primefaces datatable not displaying anything

查看:80
本文介绍了primefaces数据表不显示任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用primefaces数据表组件,但是在加载页面时它什么也没显示.全是白色的. 这是我的代码:

I'm using primefaces datatable component, but it doesnt show anything when I load the page. It is all white. This is my code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 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 id="formUsuarios">


                <p:dataTable id="dataTable" var="o" value="#{procesos.procesos}"  paginator="true" rows="10"
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             rowsPerPageTemplate="5,10,15">
                <f:facet name="header">
                        Procesos
                    </f:facet>

                    <p:column sortBy="#{o.idProceso}" headerText="ID Proceso">
                        <h:outputText value="#{o.idProceso}" />

                    </p:column>

                    <p:column sortBy="#{o.cantidad}" headerText="Cantidad">

                        <h:outputText value="#{o.cantidad}" />
                    </p:column>
                    <p:column  headerText="Condicion">

                    #{o.condicion}
                </p:column>

                    <p:column  headerText="Disposicion">

                        #{o.disposicion}
                    </p:column>
                    <p:column  headerText="Embalaje">

                        #{o.embalaje}
                    </p:column>
                    <p:column  headerText="Especie">

                        #{o.especie}
                    </p:column>
                    <p:column  headerText="EtiquetaPlu">

                        #{o.etiquetaPlu}
                    </p:column>
                    <p:column  headerText="Exportadora">

                        #{o.exportadora}
                    </p:column>
                    <p:column  headerText="Fecha Cosecha">

                        #{o.fechaCosecha}
                    </p:column>
                    <p:column  headerText="Fecha Embalaje">

                        #{o.fechaEmbalaje}
                    </p:column>
                    <p:column headerText="Fecha Inicio">

                        #{o.fechaInicio}
                    </p:column>
                    <p:column headerText="Fecha Termino">

                        #{o.fechaTermino}
                    </p:column>

                    <p:column headerText="Kilos Nominal">

                        #{o.kilosNominal}
                    </p:column>
                </p:dataTable>
            </h:form>


</ui:composition>

还有豆子

@ManagedBean(name = "procesos")
@ViewScoped
public class ProcesosBean implements Serializable {
    private List<VistaProcesosEntity> procesos;


    @PostConstruct
    public void init(){
        procesos=new ArrayList<VistaProcesosEntity>();
        procesos= Procesos.getALL();
    }

    public List<VistaProcesosEntity> getProcesos() {
        return procesos;
    }

    public void setProcesos(List<VistaProcesosEntity> procesos) {
        this.procesos = procesos;
    }
}

当我查看白页的源代码时,它显示的是:

When I look at the source code of the white page this is what it shows:

 <form id="formUsuarios" name="formUsuarios" method="post" action="/Frutemu/Contenido/vistaProcesos.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="formUsuarios" value="formUsuarios" />



                    <p:dataTable id="dataTable" var="o" value="[model2.VistaProcesosEntity@584915f4, model2.VistaProcesosEntity@584915f4, model2.VistaProcesosEntity@584915f4, model2.VistaProcesosEntity@584915f4, model2.VistaProcesosEntity@1aaed586, model2.VistaProcesosEntity@bf002e88, model2.VistaProcesosEntity@bf002e88, model2.VistaProcesosEntity@bf002e88............etc

     <p:column headerText="ID Proceso">

                        </p:column>

                        <p:column headerText="Cantidad">
                        </p:column>
                        <p:column headerText="Condicion">


                    </p:column>

                        <p:column headerText="Disposicion">


                        </p:column>... etc

推荐答案

将此行添加到我的xhtml文件中可修复所有问题:

adding this lines to my xhtml file fixed everything:

<h:head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
</h:head> 

这篇关于primefaces数据表不显示任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆