Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using a4j to load a rich:dataTable after the page loads

843844Sep 8 2008 — edited Sep 9 2008
I have a rich:dataTable that calls a session bean which executes an SQL query to generate the data to be displayed in the table. Something simple like:

<rich:dataTable rowClasses="evenRow,oddRow"
rows="30"
value="#{Bean.items}"
var="items">

where Bean.getItems() performs an SQL query and returns List<Item>.

The problem is that the query takes a long time to execute (~45 seconds) and I'd like the page to initially load while the query is being executed, displaying a spinner while it loads. Once the query is done, I'd like to update the initially empty table using ajax.

I set up a spinner using a4j:status and it works fine after the page initially loads (using a rich:datascroller).

However, the page will not initially load until the query completes, which is a problem because the query is so slow. What happens is the user clicks on the "List Items" tab from my site's homepage, sits there on the same page for 45 seconds with absolutely no visual indication that anything is happening, and then finally is taken to the list of items page.

What is needed to make the dataTable load via AJAX the first time, as well as all subsequent times?

Thanks!

Edited by: rcrowell on Sep 8, 2008 5:42 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2008
Added on Sep 8 2008
4 comments
355 views