Display view during data processing

I am on Play Framework 2.5.14, with a game for java.

I have a Service that downloads and processes some data, and it takes a lot of time to process this data.

I do like this:

Controller

 public Result showData() { List<Data> data = service.getProcessedData(); return ok(views.html.data.render(data)); } 

View

 @(data: List[Data]) <!-- html code --> 

But when I go to the page, it lasts a long time because service.getProcessData() takes too much time. When the function is completed, then the view is visualized.

I need the view to load and when the data is ready, fill out the view.

0
source share
1 answer

As I said in the comments, I did not find a solution using Play.

What I'm doing is visualizing the view, and in the view itself, I call the ajax petition in javascript / jquery to get slow data.

Hope this helps, this is the only solution I liked.

0
source

Source: https://habr.com/ru/post/1269912/


All Articles