<%@ page language="java"
import="java.util.*,java.text.*,com.codelibs.ehr.biz.SyqygcxManager,com.codelibs.ehr.entities.Syqyg"
pageEncoding="GB18030"%>
<%
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 'syqygb.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">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="allcss/iframe.css" type="text/css" rel="stylesheet" />
<script language="javascript">
function xg() {
var a = document.getElementsByName("checkbox");
var x;
for(var i = 0;i<a.length;i++) {
if(a[i].checked==true){
num++;
}
}
if(num>=2){
alert("select only one");
}else if(num==0){
alert("please select one");
}else{
for(var i = 0; i<i.length; i++) {
if(a[i].checked==true) {
x= document.getElementById("mytable").rows[i+1].cells[1].innerHTML;
}
}
document.gerElementById("dg").value=x;
}
}
</script>
</head>
<body>
<div id="content">
<p id="weizhi">
当前位置:
<a href="sy.jsp " target="content">首页</a>->
<a href="syqgl/syqygcx.jsp" target="content">试用期管理</a>->试用期员工
</p>
<fieldset>
<legend>
试用期员工
</legend>
<form action="syqygbtj.do" method="post" >
<table id="mytable">
<tr>
<td colspan="7">
试用期员工
</td>
<td>
<input type="submit" value="修改"></input>
</td>
</tr>
<tr>
<th>
选择
</th>
<th>
编号
</th>
<th>
姓名
</th>
<th>
开始时间
</th>
<th>
结束时间
</th>
<th>
状态
</th>
<th>
处理日期
</th>
<th>
备注
</th>
</tr>
<%
DateFormat d = new SimpleDateFormat("yyyy-MM-dd");
ArrayList<Syqyg> als = (ArrayList<Syqyg>) session.getAttribute("als");
String intshowPage = request.getParameter("showPage");
int showPage;
int row = als.size();
int pageSize = 6;//每一页要显示的对象数
int pages = 0;//一共显示多少页
int lastShowRow = 0;//最后的页面显示的行数
ArrayList<Syqyg> fals = (ArrayList<Syqyg>) session.getAttribute("als");
if (row % pageSize == 0 && row != 0) {
pages = (row / pageSize);
lastShowRow = pageSize;
}
if (row % pageSize != 0) {
pages = (row / pageSize) + 1;
lastShowRow = (fals.size()) % (pageSize);
}
if (pages == 1) {
for (Iterator it = fals.iterator(); it.hasNext();) {
int k = 1;
Syqyg s = (Syqyg) it.next();
out.println("<tr>");
out
.println("<td><input id='cb"
+ k
+ "' type='checkbox' name='checkbox' value='checkbox' onchange=\"xg()\" /></td>");
out.println("<td>" + s.getEm_id() + "</td>");
out.println("<td>" + s.getEm_name() + "</td>");
out.println("<td>" + d.format(s.getProb_start()) + "</td>");
out.println("<td>" + d.format(s.getProb_end()) + "</td>");
out.println("<td>" + s.getProb_results() + "</td>");
out.println("<td>" + d.format(s.getProb_date()) + "</td>");
out.println("<td>" + s.getProb_notes() + "</td>");
out.print("</tr>");
k++;
}
out.println("<tr>");
out.println("<td colspan='8'>第1页|共1页</td>");
out.println("</tr>");
} else {
if (intshowPage == null) {
showPage = 1;
}
try {
showPage = Integer.parseInt(intshowPage);
} catch (NumberFormatException e) {
showPage = 1;
}
if (showPage <= 0) {
showPage = 1;
}
if (showPage >= pages) {
showPage = pages;
}
int posion = (showPage - 1) * pageSize;
if (showPage < pages) {
for (int i = 0; i <= pageSize - 1; i++) {
int k = 1;
Syqyg s;
System.out.println(posion);
System.out.println(fals.size());
s = (Syqyg) fals.get(posion);
posion++;
out.println("<tr>");
out
.println("<td><input id='cb"
+ k
+ "' type='checkbox' name='checkbox' value='checkbox' onchange=\"xg()\"/></td>");
out.println("<td>" + s.getEm_id() + "</td>");
out.println("<td>" + s.getEm_name() + "</td>");
out.println("<td>" + d.format(s.getProb_start())
+ "</td>");
out.println("<td>" + d.format(s.getProb_end())
+ "</td>");
out.println("<td>" + s.getProb_results() + "</td>");
out.println("<td>" + d.format(s.getProb_date())
+ "</td>");
out.println("<td>" + s.getProb_notes() + "</td>");
out.print("</tr>");
k++;
}
}
System.out.println("lastShowRow" + lastShowRow);
if (showPage == pages) {
for (int l = 1; l <= lastShowRow; l++) {
int k = 1;
Syqyg s = (Syqyg) fals.get(posion);
posion++;
out.println("<tr>");
out
.println("<td><input id='cb"
+ k
+ "' type='checkbox' name='checkbox' value='checkbox' onchange=\"xg()\" /></td>");
out.println("<td>" + s.getEm_id() + "</td>");
out.println("<td>" + s.getEm_name() + "</td>");
out.println("<td>" + d.format(s.getProb_start())
+ "</td>");
out.println("<td>" + d.format(s.getProb_end())
+ "</td>");
out.println("<td>" + s.getProb_results() + "</td>");
out.println("<td>" + d.format(s.getProb_date())
+ "</td>");
out.println("<td>" + s.getProb_notes() + "</td>");
out.print("</tr>");
k++;
}
}
out.println("<tr>");
out.println("<td colspan='5'>第" + showPage + "页|共" + pages
+ "页</td>");
%>
<td colspan="3">
<a href="syqgl/syqygb.jsp?showPage=<%=showPage - 1000%>">第一页</a>|
<a href="syqgl/syqygb.jsp?showPage=<%=showPage - 1%>">上一页</a>|
<a href="syqgl/syqygb.jsp?showPage=<%=showPage + 1%>">下一页</a>|
<a href="syqgl/syqygb.jsp?showPage=<%=showPage + 1000%>">末页</a>
</td>
<%
out.println("</tr>");
}
%>
</table>
<div style="display: none" id="yc"><input type="text" name="xg" id="dg" value="qq"></input>
<input type="checkbox" onselect=""></input>
</div>
</form>
</fieldset>
</div>
</body>
</html>
但这种方法应该存在session缓存,小弟不才,没能解决,望高手能鼎力相助!