JSF + Primefaces: Problem with “rendered” components with ajax
2013-11-26 11:59
423 查看
Cant seem to get
Right, every time I click on the link
solution:
am not using Primefaces but Richfaces on my projects. So I am not really aware on how the refresh process is done by Primefaces. However, I have an idea that can be tested easily.
Your problem may be due to the fact that the component to re-render (i.e. update) is not found on the HTML page. If your
So what you can do is to always render your
Here is what I am suggesting:
This way, the panelGroup will always be refreshed after the Ajax call, and it will contain the Hello message or not, regarding the value of the
renderedto work correctly with
updateattributes. Here is my codes
<ui:define name="left"> <h:form> <p:commandLink value="Hey" actionListener="#{bean.setRenderComment}" update="comment"/> </h:form> </ui:define> <ui:define name="right"> <h:panelGroup id="comment" rendered="#{bean.renderComment}"> hello </h:panelGroup> </ui:define>
renderCommentis a boolean attributes inside
bean.
setRenderCommentbasically toggle the state of
renderCommentlike this[/code]
this.renderComment =!this.renderComment;
Right, every time I click on the link
Hey, I need to refresh to either render
helloon or off. How can I fix it, so that I dont need to refresh.
solution:
am not using Primefaces but Richfaces on my projects. So I am not really aware on how the refresh process is done by Primefaces. However, I have an idea that can be tested easily.
Your problem may be due to the fact that the component to re-render (i.e. update) is not found on the HTML page. If your
renderedattribute is equals to
false, then the
<SPAN>with
commentid is not integrated in the HTML page generated. Thus, when the Ajax request is received on the client side, the Ajax engine is not able to refresh this
<SPAN>as it is not found.
So what you can do is to always render your
panelGroupand move your
renderedattribute to a nested
<h:outputText>that contains the Hello message.
Here is what I am suggesting:
<h:panelGroup id="comment"><h:outputText value="Hello" rendered="#{bean.renderComment}"/></h:panelGroup>
This way, the panelGroup will always be refreshed after the Ajax call, and it will contain the Hello message or not, regarding the value of the
renderCommentattribute of your bean.
相关文章推荐
- jsf target=“_blank” not working with primefaces commandbutton
- Looking at JavaServer Faces: Rich Internet Components with JSF
- PrimeFaces+JSF
- Lazy JSF Primefaces Datatable Pagination
- how to use jquery with primefaces
- This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.
- Primefaces+JSF中页面组件update刷新问题,求大神解惑!
- ADF_ADF Faces系列1_使用JSF开发基于Ajax的用户界面:ADF Faces 富客户端组件简介(Part1)
- 使用 JSF 开发基于 Ajax 的用户界面:ADF Faces 富客户端组件简介
- JSF primefaces dataTable paginator 表格分页 问题
- PrimeFace JSF中使用ajax控件无法实时更新文本框inputTextarea内容
- Menu Redirect Prompt when developing in JSF+Primefaces +JQuery
- Pro JSF and Ajax: Building Rich Internet Components
- This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed
- Body onload with PrimeFaces autoRun
- Ajax Integration with JSF 2.0
- JSF+primefaces开发总结
- Two components with the same id AJAX error
- Ajax Integration with JSF 2.0
- jsf in action 笔记:在组件中使用EL语言(Using the EL with components)--2008.04.11