【发布时间】:2012-11-07 13:56:52
【问题描述】:
我有以下结构(内容和属性省略):
<ui:repeat id="outerlist">
<my:compositeComponent id="myCC">
<h:panelgroup id="container">
Some content here (outputText, etc.)
<ui:repeat id="innerlist">
<h:commandButton>
<f:ajax render=":#{cc.clientId}:container" />
<!-- all closing tags accordingly -->
由于容器内的内容取决于内部列表按钮的操作,因此我需要对其进行更新。当没有外部ui:repeat 时,如上所示的方法有效。但是,当有一个时,它会失败并出现component not found 错误。
这似乎是因为cc.clientId 本身包含外部ui:repeat 的行索引,例如outerlist:0:myCC:container。正如a comment to this answer 所指出的,此索引 ID 在视图树的服务器端表示中不可用。而是“行索引仅存在于客户端”。我必须承认我不太明白这个索引是如何完成的,以及服务器端有什么可用的。
所以我的问题是:JSF 如何进行此索引,它如何(在服务器上)在 ui:repeat 中分离不同的“实例”,并且对于我试图通过上述代码实现的目标是否有解决方案?
【问题讨论】:
标签: ajax jsf uirepeat clientid