Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse Ajax with JSF?

Tags:

java

ajax

jsf

jsf-2

Is it possible to work with reverse Ajax in JSF 2.0?

I could work with Ajax in JSF, but I don't know how to keep rendering. Any idea?

like image 253
Valter Silva Avatar asked Jun 15 '11 22:06

Valter Silva


2 Answers

With reverse Ajax you have polling where the client repeatedly queries the server looking for a response, and you have pushing where the server keeps a connection with the client and sends a response when available.

Richfaces has <a4j:poll> and <a4j:push> as part of its ajax support.

The <a4j:push> periodically perform AJAX request to server, to simulate 'push' data.

The main difference between <a4j:push> and <a4j:poll> components is that <a4j:push> makes request to minimal code only (not to JSF tree) in order to check the presence of messages in the queue. If the message exists the complete request will be performed. The component doesn't poll registered beans but registers EventListener which receives messages about events.

like image 96
Mark Avatar answered Oct 19 '22 03:10

Mark


Primefaces has p:poll.

<a4j:push> has the advantage to use CDI events.

like image 1
jacktrades Avatar answered Oct 19 '22 03:10

jacktrades