I have a spring MVC application based on spring and JSP to visualize some date on web pages. My controller originally looks like this.
public class MyController {
public ModelAndView visualizeData() {
List myList = MyClass.getMyList();
return new ModelAndView("myurl", "myList", myList);
}
}
Now I want to split this ModelAndView
method, because the MyClass.getMyList()
is slow if it gets executed at the time the user clicks /myurl
. I want it to be executed silently before a user clicks /myurl
, fetch myList
and store in client's cache before the data gets rendered so that the user won't feel the delay for displaying myList
. How can I do that?