0

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?

4

1 回答 1

2

我会在这里使用 AJAX。有一个简单地呈现页面的操作(即,当他们点击时/myurl,然后使用事件和 AJAX 来点击加载列表然后将其作为 JSON 返回onload的单独操作(可能)。/myurl/getList

于 2013-07-25T21:15:28.993 回答