2012-02-10 14 views
0

私はa4j:pollを使用して、X秒ごとにactionListenerを呼び出します(バッキングBeanで設定可能)。しかし、ページをリロードしてタイマーをリセットした場合、これを防ぐ方法はありますか?a4j:poll timer reset

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 

答えて

1

私はそう言いません。 ajax内から部分的に再読み込みしてもタイマーはリセットされませんが、ページ全体を再読み込みするとすべてのjavascriptが再起動され、すべてのポーラーが再起動されます。

ポーリングの代わりにバックエンドのトリガーを行うには、「プッシュ」を使用します。バックエンドは、フロントエンドでユーザーが何をしているかに関係なく、30秒ごとに起動するサーブレットを使用できます。 RichFaces 4.2では、プッシュは非常に簡単に実装できます。

MAG、 ミロ・ファン・デル・ジー