当前位置: 代码迷 >> Web前端 >> JQuery + Struts2翻页效能
  详细解决方案

JQuery + Struts2翻页效能

热度:119   发布时间:2012-11-23 00:03:43.0
JQuery + Struts2翻页功能
    1.引入jquery js文件及jqueryPage js文件
    2.初始化翻页工具栏
    $(document).ready(function(){
    initPageTools("workPlanList");
    initPageTools("doWillList");
    initPageTools("dailyList");
    }); 
    3.引入查询后的翻页结果界面<div id="workPlanList">
<s:include value="wokePlanList.jsp">
</s:include>
</div>
注意:div为必须
    4. 翻页界面代码如下:其中form为必须用于翻页取数据
    <%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../commons/inc.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>工作计划列表</title>
<link href="<%=path %>/css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<s:form action="queryWorkPlan.do">
<s:hidden name="taskQueryBean.startTime" id="hiddenStartTime"></s:hidden>
<s:hidden name="taskQueryBean.endTime" id="hiddenEndTime"></s:hidden>
<table width="100%" height="30" border="0" cellpadding="0"
	cellspacing="0">
	<tr>
		<td class="title_head_bg">
		<table width="100%" height="30" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td valign="middle">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td class="title_text_bg">计划列表</td>
						<td align="right"></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<table id="tt" class="table" width="100%">
			<tr class="tr_one">
				<td >
					任务名称
				</td>
				<td>
					任务描述
				</td>				
				<td>
					开始时间
				</td>
				<td>
					结束时间
				</td>
			</tr>
<s:iterator value="wtList.collection" var="u" status="s">
	<tr <s:if test="(#s.index+1)%2==0">class="t_3"</s:if>
		<s:if test="(#s.index+1)%2!=0">class="t_2"</s:if>>
		<td><s:property value='#u.taskName' /></td>
		<td><s:property value='#u.desc' /></td>
		<td><s:date name="#u.startTime" format="yyyy-MM-dd" /></td>
		<td><s:date name="#u.endTime" format="yyyy-MM-dd" /></td>
	</tr>
</s:iterator>
</table>
<table  border="0" cellpadding="0" cellspacing="0" class="table_foot" width="100%" style="margin-left: 0px;margin-right:0px;">
  <tr>
    <td class="a" >共有<span id="totalRows"><s:property value="wtList.totalRows"/></span>条记录,当前第<span id="page"><s:property value="wtList.page"/></span>页,共<span id="totalPages"><s:property value="wtList.totalPages"/></span>页</td>
    <td align="right" class="table_footright"><input type="button" class="button" id="firstPage" value="首页" >
                      <input  type="button" class="button" value="上一页" id="upPage">
                      <input  type="button" class="button" value="下一页" id="nextPage">
                      <input  type="button" class="button" value="尾页" id="lastPage">
                    转到
                    <input name="textfield" id="toPage" type="text" class="form_textfield" size="1">
                    页
    <input name="Submit5" type="button" class="button" value="转" id="toPage"></td>
  </tr>
</table>
</s:form>
</body>
</html>

5.结果封装及后台Action在程序包中,后台程序不介绍。请参考附件
  相关解决方案