2013-09-23 5 views
0

Я создаю представление в JSF, где после выполнения какого-либо действия с a4j:commandButton некоторые элементы перезагружены. Например, я нажимаю кнопку, которая вызывает метод бэк-компонента, такой как executeProcess (это добавляет процесс в список), и когда он заканчивает обновление таблицы данных (показывает доступные процессы). В таблице данных также есть несколько других кнопок для выполнения определенных действий над каждым процессом, но когда я нажимаю одну из них, страница, похоже, перезагружается полностью, не вызывая действия, тогда, если я снова нажму на ту же кнопку, она будет работать. Что происходит?Rerendered компоненты не работают должным образом

Список компонентов выполнить:

<div class="line_left" style="float:right"> 
    <a4j:outputPanel id="execProcessPanel" layout="block" 
     ajaxRendered="true"> 

     <ui:fragment rendered="#{tapeTapeForm.size > 0}"> 

      <h:form id="executeProcess"> 
       <h:outputText value="Ejecuta Proceso" /> 
       <br /> 

       <h:outputLabel id="inputFilesLabel" for="inputFile" value="Archivo" /> 
       <h:selectOneListbox id="inputFile" size="5" required="true" 
        requiredMessage="Debes seleccionar un archivo" 
        value="#{tapeTapeForm.inputFile}"> 
        <f:selectItems value="#{tapeTapeForm.inputFiles}" var="file" 
         itemLabel="#{file}" itemValue="#{file}" /> 
       </h:selectOneListbox> 
       <br /> 

       <h:message for="inputFile" errorClass="" /> 
       <br /> 

       <a4j:commandButton value="Ejecutar" styleClass="button" 
        action="#{tapeTapeForm.executeProcess}" 
        render="resultListPanel execProcessPanel messages" 
        limitRender="true"> 
        <f:setPropertyActionListener value="0" 
         target="#{tapeTapeForm.tipoProceso}" /> 
       </a4j:commandButton> 
       <a4j:commandButton value="Revisión" styleClass="button" 
        action="#{tapeTapeForm.executeProcess}" 
        render="resultListPanel execProcessPanel messages" 
        limitRender="true"> 
        <f:setPropertyActionListener value="1" 
         target="#{tapeTapeForm.tipoProceso}" /> 
       </a4j:commandButton> 
      </h:form> 

     </ui:fragment> 
    </a4j:outputPanel> 
</div> 

компонентов Таблица данных:

<a4j:outputPanel id="resultListPanel" layout="block" 
    ajaxRendered="true"> 
    <h2> 
     <h:outputText value="Listado de Procesos Tape to Tape" /> 
    </h2> 

    <rich:dataTable id="resultList" var="item" rows="0" 
     value="#{tapeTapeForm.processes}" noDataLabel="Sin Procesos"> 
     <rich:column sortable="true" sortBy="#{item.id}"> 
      <f:facet name="header"> 
       <h:outputText value="ID" /> 
      </f:facet> 
      <center> 
       <h:outputText value="#{item.id}" /> 
      </center> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Nombre Archivo" /> 
      </f:facet> 
      <center> 
       <h:outputText value="#{item.inputFileName}" /> 
      </center> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Archivo Salida" /> 
      </f:facet> 
      <center> 
       <h:outputText value="#{item.outputFileName}" 
        title="Clic para descargar el archivo de salida" /> 
      </center> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Tipo Proceso" /> 
      </f:facet> 
      <center> 
       <h:outputText value="Reporte" 
        title="Este proceso generará un reporte" 
        rendered="#{item.tipoProceso == 0}" /> 
       <h:outputText value="Revisión" 
        title="Se realizará una revisión del archivo" 
        rendered="#{item.tipoProceso == 1}" /> 
      </center> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Estatus" /> 
      </f:facet> 
      <center> 
       <h:outputText value="#{item.status.description}" 
        title="#{item.status.detail}" /> 
      </center> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Progreso" /> 
      </f:facet> 
      <rich:progressBar value="#{item.avance}" minValue="0" 
       enabled="false" rendered="#{item.status.id == 3}" 
       maxValue="#{item.total}" label="#{item.avance}/#{item.total}" /> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Detener" /> 
      </f:facet> 
      <h:form rendered="#{item.status.id == 2 or item.status.id==3}"> 
       <h:commandLink action="#{tapeTapeForm.stopProcess}" value="STOP" 
        onclick="#{rich:component('ajaxLoadingModalBox')}.show()"> 
        <f:setPropertyActionListener target="#{tapeTapeForm.id}" 
         value="#{item.id}" /> 
       </h:commandLink> 
      </h:form> 
     </rich:column> 

     <rich:column> 
      <f:facet name="header"> 
       <h:outputText value="Eliminar" /> 
      </f:facet> 
      <h:form rendered="#{item.status.id !=2 and item.status.id != 3}"> 
       <h:commandLink action="#{tapeTapeForm.removeProcess}" 
        value="ELIMINAR"> 
        <f:setPropertyActionListener target="#{tapeTapeForm.id}" 
         value="#{item.id}" /> 
       </h:commandLink> 
      </h:form> 
     </rich:column> 

    </rich:dataTable> 
</a4j:outputPanel> 

Я использую RichFaces 4.2.2

+0

Вы уверены, что версия JSF 4.2.2 ?, или версия JBoss – omainegra

+0

@omainegra: Это скорее всего версия RichFaces. – BalusC

+0

извините, Rich лица версия – Oscar

ответ

0

Избавиться от нескольких форм, завернуть все в одном а затем использовать, если вам нужно ограничить объем выполнения.

Смежные вопросы