分页中为何每页显示的项的id都是每页第一条的id,如何取得它们各自的id???

nchu_laizhibing 2013-05-27 05:44:16
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'paperlist.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<SCRIPT type="text/javascript">
function addPaper(){
window.location.href="/exam/admin/paper/addPaper.jsp";
}
function viewPaper(){
var str = document.getElementById("examPaperId").value;
alert("显示 的试卷的id值是:"+str);
window.location.href = "viewPaper?id="+str;
}
function deleteExamPaper(){
var str = document.getElementById("examPaperId").value;
window.location.href = "deleteExamPaper?id="+str;
}
function updatePaper(){
var str = document.getElementById("examPaperId").value;
window.location.href = "getUpdateExamPaperInfo?id="+str;
}
//出题
function chuTi(){
var str = document.getElementById("examPaperId").value;
window.location.href = "chuTi?id="+str;
}

function queryExamPaperByName(){
var str = document.getElementById("name").value;
window.location.href = "queryExamPaperByName?name="+str;
}
</SCRIPT>
</head>
<body>
<div>
<table width="100%" border="0">
<tr>
<td align="left"> 您现在的位置是:考试管理 -> 试卷管理 </td>
<td align="right"><input type="button" style="width: 80px;height: 30px;" onclick="addPaper();" value="添加试卷"></td>
</tr>
</table>
</div>
<br/>
<div>
名称:<input type="text" size="30" name="name" id="name" /> <input type="button" style="width: 80px;height: 30px;" onclick="queryExamPaperByName();" value="查询" >
</div>
<br/><br/>
<div>
<table cellspacing="1" border="0" id="GridView1" style="color: #333333; width: 100%" >
<tr>
<th align="center">编号</th>
<th align="center">试卷名称</th>
<th align="center">随机出题</th>
<th align="center">操作</th>
</tr>
<s:iterator status="examPaper" value="#request.list">
<tr>
<td align="center"><s:property value="id"/>
<input type="hidden" name="id" id="examPaperId" value="<s:property value="id"/>" />
</td>
<td align="center"><s:property value="name"/></td>
<td align="center"><input type="button" value="出题" onclick="chuTi();" style="width: 80px; height: 30px"> </td>
<td align="center">
<input type="button" value="删除" onclick="deleteExamPaper();"/>
   
<input type="button" value="预览" onclick="viewPaper();"/>
   
<input type="button" value="修改" onclick="updatePaper();"/>
</td>
</tr>
</s:iterator>
</table>
</div>
<br/>
<div>
<table width="90%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="bottom" align="left" nowrap="nowrap" style="width: 40%">
总记录:   
<s:property value="#request.pagination.totalRecord"/> 条    每页:   
<s:property value="#request.pagination.size"/> 条    页码: 第 
<s:property value="#request.pagination.currentPage"/>页/共
<s:property value="#request.pagination.totalPage"/>页
</td>
<td valign="bottom" align="right" nowrap="nowrap" style="60%" >
<s:if test="#request.pagination.currentPage == 1">
<span class="current">首页</span>
<span class="current">上一页</span>
</s:if>
<s:else>
<s:a href="examPaperAction?operate=first" cssStyle="margin-right:5px;">首页</s:a>
<s:a href="examPaperAction?operate=prior¤tPage=%{#request.pagination.currentPage}" cssStyle="margin-right:5px;">上一页</s:a>
</s:else>
<s:if test="#request.pagination.currentPage == #request.pagination.totalPage || #request.pagination.totalPage == 0">
<span class="current">下一页</span>
<span class="current">末页</span>
</s:if>
<s:else>
<s:a href="examPaperAction?operate=next¤tPage=%{#request.pagination.currentPage}" cssStyle="margin-right:5px">下一页</s:a>
  
<s:a href="examPaperAction?operate=end" cssStyle="margin-right:5px;">末页</s:a>
</s:else>
</td>
</tr>
</table>
</div>
</body>
</html>
...全文
76 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧