First:
Introduce the include command of JSP into external files
JSP code
- <% @ Include file =
"../Common/head. jsp"
%>
<%@include file="../common/head.jsp"%>
Purpose: When page elements are loaded, external page elements are loaded together, which may affect the page loading efficiency.
Second:
Struts label Introduction
JSP code
- <Div id =
"Left"
Class =
"Book_left"
>
- <! -- Load content in category. jsp -->
- <! -- <S: Action name = "Cate"
Namespace =
"/Main"
Executeresult =
"True"
> </S: Action> -->
- </Div>
<Div id = "Left" class = "book_left"> <! -- Load content in category. jsp --> <! -- <S: Action name = "Cate" namespace = "/main" executeresult = "true"> </S: Action> --> </div>
Purpose: when loading a page, go back and execute the corresponding action and return the corresponding information element.
Third
Asynchronous requests such as Ajax and jquery
JSP code
- <SCRIPT type =
"Text/JavaScript"
>
- $ ("# Left"
). Ajaxstart (function (){
- $ (This). Text ("loading ...."
);
- });
- $ ("# Left"
). Load (
"../Main/Cate. Do"
);
- </SCRIPT>
<SCRIPT type = "text/JavaScript"> $ ("# Left "). ajaxstart (function () {$ (this ). text ("loading .... ") ;}); $ (" # Left "). load (".. /main/Cate. do "); </SCRIPT>
Purpose: Send an asynchronous request. When the page element is loaded, request the corresponding display content. The page and data are separated to implement asynchronous loading.