<h:selectBooleanCheckBox title="showComponentToReRender" value="#{backingBean.showComponentToReRender}"> <a4j:support event="onsubmit" reRender="componentToReRender" /> </h:selectBooleanCheckBox>
这是我要隐藏的组件的代码:
<h:selectOneMenu id="componentToReRender" value="#{backingBean.value}" rendered="#{valuesList.rowCount>1 && backingBean.showComponentToReRender}"> <s:selectItems value="#{valuesList}" var="value"/> </h:selectOneMenu>
目前,单击复选框不会执行任何操作“selectOneMenu”不会消失.我究竟做错了什么?
解决方法
< h:panelGroup id =“componentToReRenderWrapper”>
要么
< a4j:outputPanel id =“componentToReRenderWrapper”>
所以,实际上你会有:
<h:panelGroup id="componentToReRenderWrapper"> <h:selectOneMenu id="componentToReRender" value="#{backingBean.value}" rendered="#{valuesList.rowCount>1 && backingBean.showComponentToReRender}"> <s:selectItems value="#{valuesList}" var="value"/> </h:selectOneMenu> </h:panelGroup>
如果使用panelGroup,则更改reRender =“componentToReRenderWrapper”,或者删除该属性,以防使用outputPanel.
在RichFaces文档中找到了确切的解释:
Most common problem with using reRender is pointing it to the component that has a “rendered” attribute. Note,that JSF does not mark the place in the browser DOM where the outcome of the component should be placed in case the “rendered” condition returns false. Therefore,after the component becomes rendered during the Ajax request,RichFaces delivers the rendered code to the client,but does not update a page,because the place for update is unkNown. You need to point to one of the parent components that has no “rendered” attribute. As an alternative,you can wrap the component with layout=”none” .
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。