ADF’s Active Data Service and scalar data (like activeOutputText)

I mentionedearlier that ADS is pretty much model driven and requires no extra sit-ups in the declarative view. It supports (currently) the following ADF components:

activeCommandToolbarButton

activeImage

activeOutputText

table

tree

All DVT components

Most examples that are viewable (or documented) provide an introduction on “How to combine ADS with collection-based data”. Let’s take a look on how to use activeOutputText with a Java Bean, as you may not have a model (or BAM).

Imagine a simple page that contains a ticker/counter. On the server-side a counter is updated every n seconds. We will use ADS to stream the data to the client. The part for the activeOutputText component is easy:

The Bean behind the page (counterBean) has a slightly tricky part, where we fake the actual model. In a @PostConstruct method we get access to the current ActiveModelContext and register a model key path for the “state” attribute: