Datatable对象为null

时间:2015-09-29 16:42:39

标签: jsf datatable

我正在尝试检索表单中的数据表列表,但此对象始终为null

<div id="Div Tabela">
    <h:form id="form">
        <p:growl id="msgs" showDetail="true" />

        <p:dataTable style="font-size:10px;width:100%" var="fila"
            value="#{mbFila.fila}" scrollable="true" scrollHeight="300"
            draggableColumns="true" draggableRows="true" resizableColumns="true"
            filterEvent="change" paginator="true"
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowsPerPageTemplate="5,10,15" currentPageReportTemplate="">
            <f:facet name="header">
                    Fila basica workflow
            </f:facet>
            <p:column width="10">
                <h:selectBooleanCheckbox value="#{fila.checkbox}" />
            </p:column>
            <p:column headerText="Auditoria" width="60"
                filterBy="#{fila.auditoria}" filterMatchMode="contains"
                filterStyle="width:50px">
                <h:outputText value="#{fila.auditoria}" />
            </p:column>
            <p:column headerText="Requisicao" width="80"
                filterBy="#{fila.requisicao}" filterMatchMode="contains"
                filterStyle="width:55px">
                <h:outputText value="#{fila.requisicao}" />
            </p:column>
        <p:commandButton value="Remover" icon="ui-icon-trash"
            action="#{mbFila.saveMessage}" type="submit">
        </p:commandButton>
      </p:dataTable>
    </h:form>
</div>

我的bean方法,当我调用'fila'来检索具有checkbox属性= true的对象时,该行只是null

public String saveMessage() {
    try {
        Boolean ok = false;

        for (int i = 0; i < fila.size(); i++) {
            if (fila.get(i).getCheckbox()) {
                fila.get(i).auditoria("Concluido");
                fila.get(i).requisicao(DateTime.now());
                ok = true;
            }

            if (fila.size() > 0) {

            }

            if (ok) {
                FacesContext context = FacesContext.getCurrentInstance();
                context.addMessage(null, new FacesMessage("Concluido com sucesso"));
            } else {
                FacesContext context = FacesContext.getCurrentInstance();
                context.addMessage(null, new FacesMessage("Selecione algum item da lista para concluir!"));
            }

            return "";
        }
    } catch (Exception e) {
        System.err.println(e);
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage("Erro desconhecido favor contactar o suporte!!"));
        return "";
    }
    return "";

}

@Method_populate_fila

public String iniciaLista(String responsavel) {
        try {

            objetosFila = d.getFila(responsavel);
            fila = fs.carregaListaFilaVO(objetosFila);

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "Operacao/fila.jsf";
    }

0 个答案:

没有答案