Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Automatically refresh datatable when Session Bean changes

 
Michael Cook
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an JSF application that uses a data table (i.e. <h:datatable>) to display the values inside of a Session Bean (via a Backing Bean). The problem I have is that the Session Bean is continuously being updated on the server. The data table needs to reside on the client side for manipulation purposes (e.g. sorting, filtering, hide/show columns)

How do I manage to push these changes to my data table?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like that you´re using entirely Javascript for sorting/filtering/hiding/showing without re-requesting the data from the server side. In this case, you can´t do anything but polling for the server for new data. HTTP disallows pushing data to the client, so you can´t do any much from the server side on.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18025
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bauke Scholtz wrote: HTTP disallows pushing data to the client, so you can´t do any much from the server side on.


Which is why true MVC is impossible via HTTP. In true MVC, asynchronous changes to the Model will cause the Controller to update the View. Since HTTP is strictly request/response, the view can only be updated when a new request is made - either by an explicit action or by having client-side polling - the HTTP standard strictly forbids unsolicited responses. In fact, without a request, the very word "response" is meaningless, since it's a reactive word, not an active one.

Still, the nice thing about JSF is that it's about as close to true MVC as HTTP will let you get.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic