简体   繁体   English

jsf错误“找不到..”在f:ajax中的ui:重复

[英]jsf error “cannot locate..” on f:ajax in the ui:repeat

I'm have something like this 我有类似的东西

<ui:repeat value="#{val}" id="repeatID" var="var">
    <h:panelGroup layout="block" id="blockForRender">
        <f:ajax execute="@this" render=":#{cc.clientId}:blockForRender"> text </f:ajax>
    </h:panelGroup>
</ui:repeat>

And this is make error - "cannot locate it in the context of the component". 这就是make错误 - “无法在组件的上下文中找到它”。 Why? 为什么? And how I can do this? 我怎么能这样做?

No this not work. 不,这不行。 Maybe because ajax is in the other composite? 也许是因为ajax在其他复合材料中?

<ui:repeat value="#{val}" id="repeatID" var="var">
 <composite:otherComposite id="otherComposite">
    <h:panelGroup layout="block" id="blockForRender">
        <f:ajax execute="@this" render=":#{cc.clientId}:blockForRender"> text </f:ajax>
    </h:panelGroup>
 </composite:otherComposite>
</ui:repeat>

Because the component with that ID doesn't exist at all. 因为具有该ID的组件根本不存在。 It's instead prefixed with the iteration index of the <ui:repeat> like so ccClientId:0:blockForRender . 它的前缀是<ui:repeat>的迭代索引,如ccClientId:0:blockForRender Open the page in browser and do View Source to see it yourself. 在浏览器中打开页面并执行查看源以自行查看。

Just omit the absolute ID prefix to make it relative to the closest parent UINamingContainer (which is the <ui:repeat> itself in your particular —heavily oversimplified— snippet). 只需省略绝对ID前缀,使其相对于最近的父UINamingContainer (在您特定的 - 过度简化的片段中是<ui:repeat>本身)。

<f:ajax ... render="blockForRender">

See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM