jsf错误“无法定位."在ui:repeat中的f:ajax上 [英] jsf error "cannot locate.." on f:ajax in the ui:repeat

查看:50
本文介绍了jsf错误“无法定位."在ui:repeat中的f:ajax上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的东西

<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". Why? And how I can do this?

不,这不起作用.也许是因为ajax在另一个复合物中?

No this not work. Maybe because ajax is in the other composite?

<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>

推荐答案

因为具有该ID的组件根本不存在.而是以< ui:repeat> 的迭代索引为前缀,就像 ccClientId:0:blockForRender 一样.在浏览器中打开页面,然后执行查看源代码自己查看.

Because the component with that ID doesn't exist at all. It's instead prefixed with the iteration index of the <ui:repeat> like so ccClientId:0:blockForRender. Open the page in browser and do View Source to see it yourself.

只需省略绝对ID前缀即可使其相对于最近的父 UINamingContainer (在您的特定—过于简化的&mdash中,它本身就是< ui:repeat> ;摘要).

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).

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

另请参见:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆