开发者

How to update a page automatically after an action of another user?

开发者 https://www.devze.com 2023-03-31 15:44 出处:网络
In my web application there\'s a page where users can post messages. The problem is a开发者_开发知识库 user always has to click a button \'get messages\' to see the messages other users have posted si

In my web application there's a page where users can post messages. The problem is a开发者_开发知识库 user always has to click a button 'get messages' to see the messages other users have posted since the moment the user started viewing the page. So the information the user is viewing is only up to date from the moment he clicked the button 'get messages' again. How can I accomplish in JSF 2.0 that when an other user deletes, inserts or updates a message, the other users can see these changes directly. One could say I'd like to accomplish something like the Facebook application does: if someone posts new information, his 'friends' can see it directly in their feed without having to push a button. Any help would be greatly appreciated.

I'm using JSF 2.0 and GlassFish Server.


You can either do polling or pushing.

Pushing is better. Refer to this thread on how to do it with JSF How can server push asynchronous changes to a HTML page created by JSF?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号