使用对象参数指定方法签名

bar*_*das 2 jsf primefaces composite-component

我正在实现一个复合组件,其中我需要使用一个命令按钮来从数据表中删除一行。这些对象可能尚未保留在数据库中(取决于操作确认),因此我无法使用 ids。

我知道我可以指定字符串或整数,但可以在界面中指定一个对象作为此单选按钮中操作的参数,应该如何完成(是否指定​​类路径)?该对象是我在支持的 bean 中管理的 DTO:

<cc:interface>
    <cc:attribute name="objectList" />
    <cc:attribute name="removeButtonAction" 
            method-signature="void removeObjectDto(ObjectDto)" />
</cc:interface>
<cc:implementation>
    <p:datatable id="myDatatable" var="objectRow" value="{#cc.attrs.objectList}">
        ...
        <p:column>
            <f:facet name="header">Delete Action</f:facet>
            <h:commandButton value="Delete" action="#{cc.attrs.removeButtonAction(objectRow)}" >
                <f:ajax execute=":myDatatable" render=":myDatatable" />
            </h:commandButton>
        </p:column>
    </p:datatable>
</cc:implementation>
Run Code Online (Sandbox Code Playgroud)

Tia*_*tos 5

是的,您可以,但您需要像这样传递完整路径:

<cc:attribute name="yourMethodName" method-signature="void yourMethodName(br.com.yourPath.YourClassName)" />
Run Code Online (Sandbox Code Playgroud)