0

I am creating a view in JSF where after executing some action with a4j:commandButton some elements are rerendered. For example I click on a button which invokes a backing bean method such as executeProcess (this adds a process to a list), and when it finishes updates a data table (shows the available processes). The data table also has some other buttons to execute specific actions over every process, but when I press one of this the page seems to reload entirely without invoking the action, then if I press the same button again it works. What is happening?

Component List an execute:

<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>

Component Data Table:

<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>

I'm using RichFaces 4.2.2

4

1 回答 1

0

摆脱多种形式,将所有内容包装在一个中,然后在需要限制执行范围时使用。

于 2013-09-25T11:28:54.083 回答