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.