Search code examples
ajaxjsfjsf-2delayed-executionmojarra

JSF Delay rendering of a component


I'm using JSF/2.0 with vanilla Mojarra.

I've got a list table of clients loading up on a screen, and 10 seconds after the screen loads, I want to put an individual dollar value next to each client name.

I'm thinking of extending an existing JSF component to do this. What's the best way to do this?

JG


Solution

  • The call has to come from the client side since the standard HTTP protocol doesn't allow the server side to push stuff to the client side. Start with JavaScript's setTimeout() function.

    <script>setTimeout(functionName, 10000);</script>
    

    You could use plain JS (or even jQuery) to do the changes. If you need to invoke a JSF action, call the jsf.ajax.request() function.