Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf a4j:轮询计时器重置_Jsf_Richfaces - Fatal编程技术网

Jsf a4j:轮询计时器重置

Jsf a4j:轮询计时器重置,jsf,richfaces,Jsf,Richfaces,我使用a4j:poll每X秒调用一个actionListener(可在支持bean中配置)。但是,如果我重新加载页面,计时器会重置,有什么方法可以防止这种情况发生吗 Example: I set the interval to 30000 (30 seconds) Second 0: The page is loaded for the first time Second 15: I reload the page, by pressing F5 or by clicking on a l

我使用a4j:poll每X秒调用一个actionListener(可在支持bean中配置)。但是,如果我重新加载页面,计时器会重置,有什么方法可以防止这种情况发生吗

Example:   I set the interval to 30000 (30 seconds)
Second 0:  The page is loaded for the first time
Second 15: I reload the page, by pressing F5 or by clicking on a link to the same page
Second 30: I expect the actionListener to be called but nothing happens
Second 45: The actionListener finally gets called, exactly 30 seconds after the reload

我想说不。从ajax内部部分重新加载不会重置计时器,但重新加载整个页面会重新启动所有javascript,从而重新启动所有轮询器

您可以使用“推送”来执行后端触发,而不是轮询。后端可以使用一个servlet,该servlet每30秒触发一次,与用户在前端的操作无关。使用RichFaces 4.2,推送非常容易实现

杂志, 米洛·范德泽