Delayed Data Loading

Source: Internet
Author: User

Delayed Data Loading

We often see this effect when surfing the Internet. After we send a request, the data is displayed in a circle before the browser.

I was curious today, so I found some materials to study.

LazyLoad. jsp

<% @ Page language = "java" pageEncoding = "UTF-8" %> <% @ taglib uri = "/struts-tags" prefix = "s" %> <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN"> Data Source of mframework.html

The Code is as follows:

<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN"> Loading32.gif:

The result of lazyLoad. jsp is as follows:


As for the submitted request searchFile, It is a struts action

Struts. xml is as follows

         <action name="searchFile" class="cdm.module.file.action.SearchFileAction" method="lazyLoad"><result>/return.jsp</result></action>
Corresponding function:
    public String  lazyLoad(){        try {            Thread.sleep(5000);        } catch (InterruptedException e) {            // TODO Auto-generated catch block            e.printStackTrace();        }        return SUCCESS;    }
Return. jsp is the simplest display.

<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd"> 

Final Effect

Click to query within 5 seconds

5 seconds later, the return. jsp content will be displayed.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.