Reputation: 173
I have a jsf page with a p:poll tag with a listener and an update. The update is called but the listener is not.
I slowly removed sections from the jsf page until I narrowed down the issue to a <f:validateLongRange>
tag. If I removed the validate the listener is called but with it in it is not.
The simplified jsf page is below. Why the validate would be causing issues with the poll?
I am using primefaces 3.5 and JSF 2.1 running on Tomcat 7.
<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:p="http://primefaces.org/ui">
<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">
<ui:define name="menuId">
#{trackTabBean.setCurrentTab(trackTabBean.devicesTab)}
</ui:define>
<ui:define name="content">
<f:metadata>
<f:viewParam name="cgId" value="#{deviceBean.inputControlGroupId}"
validatorMessage="Control Group Id must be between 1 and 254">
<f:validateLongRange maximum="254" minimum="0" />
</f:viewParam>
<f:viewParam name="devId" value="#{deviceBean.inputDeviceId}" />
<f:event listener="#{deviceBean.loadDevice}" type="preRenderView"></f:event>
</f:metadata>
<h:form id="deviceForm">
test (Load more code here but removed for testing)
<p:poll interval="5" listener="#{deviceBean.updateDetails}" update="deviceForm"/>
</h:form>
<h:form>
</h:form>
</ui:define>
</ui:composition>
</html>
Upvotes: 1
Views: 2896
Reputation: 815
Your listener is not being called, as you probably have some validation errors. In the JSF Life-cycle Phase 3 is the "Process Validations" Phase, if this phase fails JSF will immediately jump to phase 6, which is "Render Response" Phase. So phase 5 "Invoke application" where the listener gets called, will be skipped.
Make sure that neither deviceBean nor inputControlGroupId is null and applies the given constraint.
#{deviceBean.inputControlGroupId}
Upvotes: 2