0

我正在尝试使用 rich:hashParam 标签将值传递给 rich:popupPanel,这是我的代码

<h:commandLink value="Edit">
<rich:componentControl target="editPanel" operation="show">
    <a4j:param noEscape="true" value="event" />
    <rich:hashParam>
        <a4j:param name="categoryId" value="#{ c.categoryId }" />
        <a4j:param name="categoryName" value="#{ c.name }" />
        <a4j:param name="categoryParent" value="#{ c.parent }" />
    </rich:hashParam>
</rich:componentControl>

这是我的弹出面板,用户可以做某事

<rich:popupPanel id="editPanel" autosized="true">
    <!-- how to get value of the rich:hashParam? -->
</rich:popupPanel>

我参考了有关rich:hashParam 的richfaces 文档和示例,以了解如何在rich:popupPanel 中获取值。但似乎该文档包含很少关于rich:hashParam 的示例,并且该示例是硬编码的,而不是由rich:hashParam 传递的。

文件:这里

示例:这里

有人对此有想法吗?提前致谢。

4

1 回答 1

1

好吧,我自己解决了这个问题。我没有使用 传递参数,而是将参数rich:hashParam传递给弹出面板,a4j:param并将值分配给支持 bean 属性。然后重新渲染a4j:outputPanel显示参数值的一个。

<h:form id="editDataForm">
    <!-- server do something with the 'categoryId' parameter it gets -->
    <a4j:commandLink action="#{ testBackingBean.editData }" value="Edit" render="dataContent" oncomplete="#{rich:component('editPanel')}.show()">
        <a4j:param name="data" value="#{ c.categoryId }" assignTo="#{ testBackingBean.categoryId }"/>
    </a4j:commandLink>
</h:form>
<!--...-->
<rich:popupPanel id="editPanel">
    <a4j:outputPanel id="dataContent" layout="inline">
        <h:outputText value="ID:"/>
        <h:outputText value="#{ testBackingBean.dataToEdit.categoryId }"/>
    </a4j:outputPanel>
</rich:popupPanel>
于 2012-08-28T08:54:17.633 回答