JSF 2.0:在ui中重新渲染/更新单个项目:使用AJAX重复
发布时间:2020-12-16 02:55:38 所属栏目:百科 来源:网络整理
导读:我的页面包含几个区域,这些区域是通过使用 ui:repeat迭代项目列表而创建的.想象一下这个简化的例子: h:form id="form" ui:repeat id="repeatContainer" var="item" value="#{testBean.items}" varStatus="status" h:outputText value="#{item.title}: "/ !
我的页面包含几个区域,这些区域是通过使用< ui:repeat>迭代项目列表而创建的.想象一下这个简化的例子:
<h:form id="form"> <ui:repeat id="repeatContainer" var="item" value="#{testBean.items}" varStatus="status"> <h:outputText value="#{item.title}: "/> <!-- I want to re-render only a single one of these fields --> <h:outputText id="valueContainer" value="#{item.value}"/><br/> </ui:repeat> </h:form> 现在,我想使用AJAX(例如,索引为1的元素)重新渲染(仅)此列表中特定元素的valueContainer.我已经尝试过所有这些组合而没有任何运气: <!-- Works,but renders all items: --> <f:ajax render=":form"/> <!-- This is what I actually want to achieve (does not work,comp. not found): --> <f:ajax render=":form:repeatContainer:1:valueContainer"/> <!-- Does not work (component not found): --> <f:ajax render=":form:repeatContainer"/> <!-- Does not work (component not found): --> <f:ajax render=":form:repeatContainer:1"/> <!-- Does not work (component not found): --> <f:ajax render=":form:1"/> <!-- Does not work (component not found): --> <f:ajax render=":form:1:valueContainer"/> <!-- Does not work (no error message,but does nothing): --> <f:ajax render=":form:repeatContainer:valueContainer"/> 我的要求包括: >我需要识别组件 我想我必须有一个简单的解决方案,我目前正在俯瞰?! 解决方法
这似乎是由Mojarra 2.0.2中的两个独立错误引起的.以下主题讨论了相关问题:
How to refer to dataTable parent within the dataTable? 就我而言,我使用的是PrimeFaces< p:dataGrid>而不是< h:dataTable>,但它似乎遭受相同的症状.引用失败了.我想这与UIComponent#findComponent()中的错误或JSF实现的基础方法有关. 看起来目前还没有这个问题的解决方案…除了等待修复JSF实现…如果其他人有进一步的建议,请随时添加它们. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |