0
Guys, I have a div that needs to be updated in 5s, but it’s giving error saying that the ID is not found.
<h:form id="form">
<br />
<center><h:outputLabel value="Visão Geral" class="titlePrincipal" /></center>
<p:poll interval="#{controleBean.ciclo}" update="refreshArea" />
<div id="refreshArea">
<ui:repeat var="abr" value="#{controleBean.auxiliarbr}" varStatus="status">
<div class="containerBomba" title="Descrição">
<div class="reservatorio reservatorio#{controleBean.verificarNivelReservatorio()}" title="Reservatório">
<h:outputText value="#{abr.reservatorio.nomeReservatorio} (#{controleBean.verificarNivelReservatorio()}%)" />
</div>
<ui:repeat var="b" value="#{abr.bombas}" varStatus="status2">
<div class="bomba bomba#{controleBean.verificarEstadoBomba(b)}" title="Bomba">
<h:outputText value="#{controleBean.verificarNomeBomba(abr, b)}" />
</div>
</ui:repeat>
</div>
</ui:repeat>
</div>
</h:form>
Exception
Out 27, 2015 12:04:58 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/Hidros] threw exception [Cannot find component with expression "refreshArea" referenced from "form:j_idt56".] with root cause
javax.faces.FacesException: Cannot find component with expression "refreshArea" referenced from "form:j_idt56".
at org.primefaces.expression.SearchExpressionFacade.resolveComponentInternal(SearchExpressionFacade.java:422)
at org.primefaces.expression.SearchExpressionFacade.resolveComponentForClient(SearchExpressionFacade.java:200)
at org.primefaces.expression.SearchExpressionFacade.resolveComponentsForClient(SearchExpressionFacade.java:147)
at org.primefaces.util.AjaxRequestBuilder.addExpressions(AjaxRequestBuilder.java:92)
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:85)
at org.primefaces.component.poll.PollRenderer.encodeEnd(PollRenderer.java:61)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
I tried :form:refreshArea, but it didn’t work either.
Someone can help out?
Try to put inside a
p:panel
or ah:panelGroup
and tries to update by passing'id do form':'id do container'
, where container will be thep:panel
or theh:panelGroup
.– Weslley Tavares
you will not be able to update non-jsf components. Replace your div with a jsf component. Complement: http://stackoverflow.com/a/13011934/5165064
– Rafael