ajax - Cannot use autorefresh(a4j:poll) in Richfaces 4 -



ajax - Cannot use autorefresh(a4j:poll) in Richfaces 4 -

i implement a4j:poll auto-refresh result. implement source code next below code not fine.

================================================================================

<a4j:region> <h:form> <a4j:poll id="poll" interval="500" enabled="#{pollbean.pollenabled}" render="poll,grid" /> </h:form> </a4j:region> <h:form> <h:panelgrid columns="2" width="80%" id="grid"> <h:panelgrid columns="1"> <h:outputtext value="polling inactive" rendered="#{not pollbean.pollenabled}"></h:outputtext> <h:outputtext value="polling active" rendered="#{pollbean.pollenabled}"></h:outputtext> <a4j:commandbutton style="width:120px" id="control" value="#{pollbean.pollenabled?'stop':'start'} polling" render="poll, grid"> <a4j:param name="polling" value="#{!pollbean.pollenabled}" assignto="#{pollbean.pollenabled}" /> </a4j:commandbutton> </h:panelgrid> <h:outputtext id="serverdate" style="font-size:16px" value="server date: #{pollbean.date}" /> </h:panelgrid> </h:form>

================================================================================

@managedbean(name = "pollbean") @viewscoped public class pollbean implements serializable { private static final int poll_disablement_interval = 60000; private static final long serialversionuid = 7871292328251171957l; private date pollstarttime; private boolean pollenabled; public pollbean() { pollenabled = true; } public date getdate() { date date = new date(); if (null == pollstarttime) { pollstarttime = new date(); homecoming date; } if ((date.gettime() - pollstarttime.gettime()) >= poll_disablement_interval) { setpollenabled(false); } homecoming date; } public boolean getpollenabled() { homecoming pollenabled; } public void setpollenabled(boolean pollenabled) { if (pollenabled) { setpollstarttime(null); } this.pollenabled = pollenabled; } public date getpollstarttime() { homecoming pollstarttime; } public void setpollstarttime(date pollstarttime) { this.pollstarttime = pollstarttime; } }

================================================================================

please help me out of problem give thanks help eiam

the code not fine? need provide more details not working...

ajax jsf-2 richfaces

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -