It's not a secret anymore!*
The moose likes JSF and the fly likes How  client and admin in jsf application can communicate each other Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How  client and admin in jsf application can communicate each other" Watch "How  client and admin in jsf application can communicate each other" New topic
Author

How client and admin in jsf application can communicate each other

krishna neerukonda
Greenhorn

Joined: Jun 15, 2012
Posts: 6
Hi everyone,
I am new to jsf, In my project I have two modules one is client module and the other one is administrator module . My requirement is that when client logged in one browser and admin logged in another browser they both need to communicate each other. For example if client submitted any information to admin a datatable on admin side should update and vice versa...(I am using jsf with rich faces)

if any solution i will be very thankful to you.... guys...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

When working with any web application in any platform in any language, one rule remains the same. The server software does not run users as processes, it accepts user requests, processes them, and returns results on a one-to-one request-to-result basis.

Because of this, you cannot do software-to-software communications, since the software is only running for the duration of the request/response process. Instead, the respective request processors must use shared storage resources to communicate.

One such resource is an application-scope attribute, which in JSF would be a backing bean with the "applicationscoped" characteristic. Another such resource might be a record in persistent storage.

Any time, however, that you have modification of shared data, regardless of what mechanism you use, it is your responsibility to make the modification and access thread-safe. Failure to do so will have unpredictable results.


Customer surveys are for companies who didn't pay proper attention to begin with.
krishna neerukonda
Greenhorn

Joined: Jun 15, 2012
Posts: 6
Tim Holloway wrote:When working with any web application in any platform in any language, one rule remains the same. The server software does not run users as processes, it accepts user requests, processes them, and returns results on a one-to-one request-to-result basis.

Because of this, you cannot do software-to-software communications, since the software is only running for the duration of the request/response process. Instead, the respective request processors must use shared storage resources to communicate.

One such resource is an application-scope attribute, which in JSF would be a backing bean with the "applicationscoped" characteristic. Another such resource might be a record in persistent storage.

Any time, however, that you have modification of shared data, regardless of what mechanism you use, it is your responsibility to make the modification and access thread-safe. Failure to do so will have unpredictable results.


I have goggled some sites to solve my problem they explained about polling but i didn't understand. Can you let me know what is polling and is it a solution for my problem.?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Polling is the act of periodically querying a server. Because HTTP does not permit unsolicited responses, a request has to be made from the client for each desired response.

The easiest way to do this is to put an HTML refresh META tag in the page that you want to update and define a polling interval value. Once the interval has expired, the client (browser) will re-issue the URL request in order to get an updated copy of the page.

Doing that replaces the entire webpage, though, which can be visually undesirable, so some apps use AJAX to do polled partial-page updates instead. Some of the extension tag libraries provide special "poll" tags to make that easier. RichFaces is one of them.
krishna neerukonda
Greenhorn

Joined: Jun 15, 2012
Posts: 6
Tim Holloway wrote:Polling is the act of periodically querying a server. Because HTTP does not permit unsolicited responses, a request has to be made from the client for each desired response.

The easiest way to do this is to put an HTML refresh META tag in the page that you want to update and define a polling interval value. Once the interval has expired, the client (browser) will re-issue the URL request in order to get an updated copy of the page.

Doing that replaces the entire webpage, though, which can be visually undesirable, so some apps use AJAX to do polled partial-page updates instead. Some of the extension tag libraries provide special "poll" tags to make that easier. RichFaces is one of them.


Thank you for explaining about poling. Is it possible to refresh particular client(browser) periodically from server basing on session.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Like I said, the server cannot volunteer anything. Only the client can request. The best that the server can do is provide the information that the client uses (such as the page refresh META element).
 
jQuery in Action, 2nd edition
 
subject: How client and admin in jsf application can communicate each other
 
Similar Threads
JSF Problem: session is shared between all clients
JSF trinidad -hangs (IE 7)
how do I know when client closes the browser ?
Detect Client Shutdown
Question