如何获得丰富的参数值:
问题描述:
我试图值传递给富有hashParam:popupPanel具有丰富:hashParam标签,这里是我的代码如何获得丰富的参数值:
<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>
我已经提到了RichFaces的文档和例子是富翁:hashParam找出如何内致富值:popupPanel。但似乎该文档包含一些关于rich:hashParam,并且该示例是硬编码的,而不是由rich:hashParam传递。
文件:Here
例子:Here
有没有人有这样的想法?提前致谢。
答
那么,我自己解决了这个问题。我不通过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>