code Java programming

Apache Tapestry 5 Progress Bar with jQuery+Bootstrap [w/code]

How to build a progress bar for a long background operation in Tapestry 5, jQuery with Bootstrap styling.

Just sharing a code snippet about how to implement a jQuery+Bootstrap progress bar for a background operation in Tapestry 5. There’s not a lot to it, but it took me a while and serious digging through the internet to find how to make it work. Essentially it’s based on a coupleĀ of examples and references I found:

But IĀ simplified things because I don’t like the over-design Java can easily make you do…

Basically, it’s a server side ( and client side (progressbar.js) component that communicate with each other via ajax.
All you have to do is set it up in the template, and implement a function to return the progress (double onUpdateFromProgressBar()).
To run a process in the background I used the ParallelExecutor which uses the Invokable interface. So to add the progress tracking to Invokable I extended it like in the example from Lance (here).
Then it’s all very simple just tracking the progress within the background process and the client is polling it periodically.
Here’s the gist:


Leave a Reply

Your email address will not be published. Required fields are marked *