2013-09-24 27 views
0

我在這裏做了這段代碼,q旨在列出銀行的值,並且用戶可以通過dataTable更新日期。到目前爲止,我設法達到了這一點,只有這樣,才能設置用戶輸入的值。我無法在世界任何地方找到這個值,已經運行了tdo,並且輸入框中的值不會出現。我使用了幾種類型的變量,但沒有。錯誤空指針JSF傳輸數據

<p:dataTable id="dataTable" 
          var="Arquivo" 
          paginator="true" 
          paginatorPosition="bottom" 
          rowsPerPageTemplate="100" 
          rows="100" 
          sortBy="#{Arquivo.id}" 
          value="#{arquivoBean.dataModelArquivo}" 
          rowStyleClass="#{Arquivo.pendente eq 1 ? 'ok' : 'erro'}" 
          > 
        <p:column headerText="ID"> 
         #{Arquivo.id} 
        </p:column> 
        <p:column headerText="Nome"> 
         #{Arquivo.nome} 
        </p:column> 
        <p:column headerText="Envio"> 
         #{Arquivo.dataEnvio} 
        </p:column> 
        <p:column headerText="Produto" width="10px;"> 
         <h:form id="formProduto"> 
          <p:commandButton icon="ui-icon-circle-zoomout" value="" 
              action="#{arquivoBean.listarProdutoPorArquivo()}" 
              oncomplete="prodDialog.show()" 
              update=":form:dataTableProd" 
              onclick="listarProd([{name: 'ArquivoId', value:#{Arquivo.id}}]);"> 
           <f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/> 
          </p:commandButton> 
         </h:form> 
        </p:column> 
        <p:column headerText="Data" > 
         <p:inputMask id ="entrada#{cc.clientId}" mask="99/99/9999" value="#{Arquivo.dataEntrada}" 
            onkeypress="if (event.keyCode === 13) { 
                 test([{name: 'ArquivoId', value:#{Arquivo.id}}]); 
                 return; 
                };" 
            size="8"> 
          <f:convertDateTime pattern="dd/MM/yyyy"/> 
         </p:inputMask> 
        </p:column> 
       </p:dataTable> 

多閒逛之後,我發現鉻的這個錯誤檢查的元素,標籤網絡:

<partial-response id="j_id1"><error><error-name>class java.lang.NullPointerException</error-name><error-message><![CDATA[]]></error-message></error></partial-response> 
+0

創建/安裝體面的ajax異常處理程序並重試。它應該給你完整的堆棧跟蹤和原因的線索。 JSF實用程序庫OmniFaces有這樣的一個:http://showcase.omnifaces.org/exceptionhandlers/FullAjaxExceptionHandler – BalusC

+0

對不起,但我有錯誤是由於豆的結果,而不是事務。 問題是我不能設置h:InputMask的值,另一個想法? –

回答

0

我固定取出型塊,並把多種形式到位的需求。 只是它使作品。

<?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"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://xmlns.jcp.org/jsf/html" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:p="http://primefaces.org/ui" 
    xmlns:f="http://java.sun.com/jsf/core"> 

<ui:decorate template="/resources/Template.xhtml"> 
    <ui:define id="content" name="content"> 
     <p:growl id="war"/> 
     <style type="text/css"> 
      .ok{ 
       color: #336600 
      } 
      .erro{ 
       color: #D20005; 
      } 
     </style> 

     <div style="width: 90%; margin-left: auto; margin-right: auto; "> 
      <h:form id="form"> 
       <br/> 
       <br/> 
       <p:panel> 
        <f:facet name="header"> 
         Lista de Arquivos Armazenados       
        </f:facet>  
        <h:form id="pesquisar"> 
         <p:toolbar style="width: 100%;"> 
          <p:toolbarGroup align="left" > 
           <h:panelGrid columns="1" cellpadding="0">        
           </h:panelGrid> 
          </p:toolbarGroup>       
          <p:toolbarGroup align="right"> 
           <h:panelGrid columns="5" cellpadding="0"> 
            <h:outputLabel value="De: "/> 
            <p:inputMask mask="99/99/9999" value="#{arquivoBean.dataInicial}" size="10"/> 
            <h:outputLabel value="Até: "/> 
            <p:inputMask mask="99/99/9999" value="#{arquivoBean.datafinal}" size="10"/> 
            <p:commandButton value="Buscar" action="#{arquivoBean.listar()}" update=":form:dataTable" ajax="false"/> 
            <br/> 
            <p:selectBooleanCheckbox id="check" value="#{arquivoBean.pendente}" 
                  itemLabel="Pendente"> 
             <p:ajax process="@this" event="change" listener="#{arquivoBean.listarPendente()}" update=":form:dataTable" /> 
            </p:selectBooleanCheckbox> 
            <p:button value="Ajustar Datas" outcome="/telas/armazenado/listaData.xhtml"/> 
           </h:panelGrid> 

          </p:toolbarGroup> 
         </p:toolbar> 
        </h:form> 
       </p:panel> 
       <br/> 
       <p:dataTable id="dataTable" 
          var="Arquivo" 
          paginator="true" 
          paginatorPosition="bottom" 
          rowsPerPageTemplate="100" 
          rows="100" 
          sortBy="#{Arquivo.id}" 
          value="#{arquivoBean.dataModelArquivo}" 
          rowStyleClass="#{Arquivo.pendente eq 1 ? 'ok' : 'erro'}" 
          emptyMessage="Você ainda não ativou uma empresa ou não existe postagem para esta Empresa"> 
        <p:column headerText="ID"> 
         #{Arquivo.id} 
        </p:column> 
        <p:column headerText="Nome"> 
         #{Arquivo.nomeMury} 
        </p:column> 
        <p:column headerText="Envio"> 
         #{Arquivo.dataEnvio} 
        </p:column> 
        <p:column headerText="Produto" width="10px;"> 
         <h:form id="formProduto"> 
          <p:commandButton icon="ui-icon-circle-zoomout" value="" 
              action="#{arquivoBean.listarProdutoPorArquivo()}" 
              oncomplete="prodDialog.show()" 
              update=":form:dataTableProd" 
              onclick="listarProd([{name: 'ArquivoId', value:#{Arquivo.id}}]);"> 
           <f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/> 
          </p:commandButton> 
         </h:form> 
        </p:column> 
       </p:dataTable> 
       <p:dialog closeOnEscape="true" 
          widgetVar="prodDialog" 
          modal="true" 
          header="Lista de Produtos da NF-e" 
          style="width: 300; height: 500" 
          position="center"> 
        <p:dataTable 
         id="dataTableProd" 
         var="XmlItens" 
         paginator="true" 
         paginatorPosition="bottom" 
         rowsPerPageTemplate="10" 
         rows="10" 
         value="#{arquivoBean.listaProd}"> 
         <p:column headerText="ID"> 
          #{XmlItens.id} 
         </p:column> 
         <p:column headerText="Nome"> 
          #{XmlItens.descricaoProd} 
         </p:column> 
         <p:column headerText="Envio"> 
          #{XmlItens.chaveNfe} 
         </p:column> 
        </p:dataTable> 
        <p:remoteCommand name="test" action="#{arquivoBean.inserirDataNota()}"> 
         <f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/> 
        </p:remoteCommand> 
        <p:remoteCommand name="listarProd" action="#{arquivoBean.listarProdutoPorArquivo()}" update=":form:dataTableProd"> 
         <f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/> 
        </p:remoteCommand> 
       </p:dialog> 
      </h:form> 
     </div> 
    </ui:define> 
</ui:decorate> 
</html>