1

我正在尝试创建 dataTable 的compositeComponent,但我不能将remoteCommand 和commandButton 放在复合中。我的代码如下:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui">
<composite:interface>
<composite:attribute name="var" />
<composite:attribute name="value" />
<composite:attribute name="newLine" />
<composite:facet name="header" />
<composite:facet name="footer" />
    </composite:interface>
    <composite:implementation>
<h:outputScript name="js/helper.js" />
<p:dataTable value="#{cc.attrs.value}" rowIndexVar="row">
    <c:set target="#{component}" property="var" value="#{cc.attrs.var}" />
    <composite:insertFacet name="header" />
    <p:column>
        <h:outputText value="#{row + 1}" />
        <p:remoteCommand action="#{contatoController.crud.save}"
            name="ajax#{row}">
                <f:setPropertyActionListener                                          target="#{contatoController.crud.row}" value="#{contato}" />
        </p:remoteCommand>
    </p:column>
    <composite:insertChildren />
    <p:column>
        <p:commandButton ajax="false" title="Alterar" icon="ui-icon-trash"
            action="#{contatoController.crud.delete}" process="@this">
    <f:setPropertyActionListener target="#           {contatoController.crud.row}"
                value="#{cc.attrs.var}" />
        </p:commandButton>
    </p:column>
    <composite:insertFacet name="footer" />
</p:dataTable>

当我单击 ManagedBean 中的值时,我在属性上传递了 var 字符串,但应该从 dataTable 行到达对象。有人能帮我吗?

4

0 回答 0