First look at a simple application, inA. jspWrite the following code
<Div>
<JSP: Include page = "name. jsp">
<JSP: Param name = "name" value = "XY"/>
</Jsp: Include>
</Div>
This transfers the parameter named name and value XY to name. jsp.
InName. jspReceiving Parameters
<%
String n = request. getparameter ("name ");
If (n! = NULL &&! "". Equals (N. Trim ()))
Out. println (N );
%>
<Div id = "showname"> <% = URL> </div>
Let's look at a paging application.
Pager. jsp
<% @ Page Language = "Java" Import = "Java. util. *" pageencoding = "UTF-8" %>
<%
String Path = request. getcontextpath ();
String basepath = request. getscheme () + ": //" + request. getservername () + ":" + request. getserverport () + path + "/";
%>
<% @ Tagliburi = "/Struts-tags"
Prefix = "S" %>
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
<HTML>
<Head>
<Base href = "<% = basepath %>">
</Head>
<Body>
<%
String url = request. getparameter ("url ");
%>
<S: If test = "# request. yrlyquery = NULL">
<S: If test = "data. totalpage> 1">
<S: If test = "data. totalpage = pageintnum">
<A href = "<% = URL %>? Pagenum = 1 "> homepage </a> & nbsp;
<A href = "<% = URL %>? Pagenum = <s: property value = "pageIntNum-1"/> "> previous page </a> & nbsp;
</S: If>
<S: elseif test = "pageintnum = 1">
<A href = "<% = URL %>? Pagenum = <s: property value = "pageintnum + 1"/> "> next page </a>
<A href = "<% = URL %>? Pagenum = <s: property value = "data. totalpage"/> "> last page </a> & nbsp;
</S: elseif>
<S: else>
<A href = "<% = URL %>? Pagenum = 1 "> homepage </a> & nbsp;
<A href = "<% = URL %>? Pagenum = <s: property value = "pageIntNum-1"/> "> previous page </a> & nbsp;
<A href = "<% = URL %>? Pagenum = <s: property value = "pageintnum + 1"/> "> next page </a> & nbsp;
<A href = "<% = URL %>? Pagenum = <s: property value = "data. totalpage"/> "> last page </a>
</S: else>
</S: If>
</S: If>
<S: else>
<S: If test = "data. totalpage> 1">
<S: If test = "data. totalpage = pageintnum">
<A href = "<% = URL %>? Querytype = Q & pagenum = 1 "> homepage </a> & nbsp;
<A href = "<% = URL %>? Querytype = Q & pagenum = <s: property value = "pageIntNum-1"/> "> previous page </a> & nbsp;
</S: If>
<S: elseif test = "pageintnum = 1">
<A href = "<% = URL %>? Querytype = Q & pagenum = <s: property value = "pageintnum + 1"/> "> next page </a> & nbsp;
<A href = "<% = URL %>? Querytype = Q & pagenum = <s: property value = "data. totalpage"/> "> last page </a>
</S: elseif>
<S: else>
<A href = "<% = URL %>? Querytype = Q & pagenum = 1 "> homepage </a> & nbsp;
<A href = "<% = URL %>? Querytype = Q & pagenum = <s: property value = "pageIntNum-1"/> "> previous page </a> & nbsp;
<A href = "<% = URL %>? Querytype = Q & pagenum = <s: property value = "pageintnum + 1"/> "> next page </a>
<A href = "<% = URL %>? Querytype = Q & pagenum = <s: property value = "data. totalpage"/> "> last page </a>
</S: else>
</S: If>
</S: else>
Current
<S: property value = "pageintnum"/>
Total pages
<S: property value = "data. totalpage"/>
Page
</Body>
</Html>
Here, pagenum and data. totalpage are involved in SSH paging, so we will not go into details here.
Stduent. jsp
......
<Div>
<JSP: Include page = "../pager. jsp">
<JSP: ParamName = "url"/value = "Stu/stu_toquery"/>
</Jsp: Include>
</Div>
......
In this way, the paging page can be embedded.