a4j:poll re-rendering/decoding all the xhtml page?
juangon Apr 25, 2009 12:50 AMHi I have a problem that could be a performance issue in the xhtml (Facelets) that I am currently developing.
I have a a4j:poll that find new messages for the user. To achieve this, I have a main facelet template that have an sticky footer with the a4j:poll.
I have a Facelet template like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="cache-control" content="no-store" />
<title><ui:insert name="title">Title</ui:insert></title>
<head> ....
</head>
<body>...
...
<h:form >
<rich:modalPanel .id="ajaxErrorModalPanel">
..
..
</rich:modalPanel>
</h:form>
<a4j:region>
<h:form>
<a4j:status id="ajaxLoadingStatusModal">
....
</a4j:status>
</h:form>
</a4j:region>
<div id="page">
<div id="header">
<ui:insert name="header">Â </ui:insert>
</div>
<div id="body">
<ui:insert name="body">Â </ui:insert>
</div>
<div id="stickyFooter">
<h:panelGroup rendered="#{someCondition}">
<h:form>
<a4j:region>
<a4j:poll id="messagesPoll"
interval="#{someInterval}"
enabled="true"
actionListener="#{someActionListener}"
timeout="60000" status="loadingMessagesStatus"
reRender="userMessagesPanel" ajaxSingle="true"/>
</a4j:region>
</h:form>
<h:form>
<a4j:region>
<rich:toolBar id="stickyToolBar">
<a4j:status id="loadingMessagesStatus">
<f:facet name="start">
<h:graphicImage .../>/indicator.gif"
title="Loading..."
height="8px" width="8px" />
</f:facet>
</a4j:status>
<rich:toolBarGroup location="left">
<a4j:outputPanel id="userMessagesPanel">
....
.....
</a4j:outputPanel>
</rich:toolBarGroup>
</rich:toolBar>
</h:panelGroup>
</div>
</body>
</html>
And I have a page with a rich:datatable that uses the same facelets template (same as written above).
I saw that in my server logs the rich:datatable was updating every time tha poll was executed.
I have been searching over the forums here for some weeks, and all the solutions mentioned (putting the poll in another h:form, another a4j:region, ajaxSingle=true", limitToList="true") didn't work.
Please how could I execute the poll without interfere with the rest of the xhtml page? I am desperated!
Thanks very much!