<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="org.apache.struts.util.LabelValueBean"%>
<%@ page import="java.util.List"%>
<%@ taglib uri="struts-bean" prefix="bean"%>
<%@ taglib uri="struts-html" prefix="html"%>
<%@ taglib uri="struts-logic" prefix="logic"%>
<%@ page import="com.neusoft.schoolcard.dao.sysmanager.PersonVO"%>
<%@ page import="com.neusoft.schoolcard.bo.CardUserManagerBO"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<xml id="xmlPersons">
<personList>
<logic:iterate id="tmp" name="vo" scope="request"><!-- vo是个ArrayList里面存放的是PersonVO -->
<part>
<accounthref><%=path%>/CardUserManagerAction.do?method=updatePerson&operate=<bean:write name="tmp" property="account"/></accounthref>
<account><bean:write name="tmp" property="account"/></account>
<name><bean:write name="tmp" property="name"/></name>
<sex><logic:equal name="tmp" property="sex" value="11">男</logic:equal><logic:equal name="tmp" property="sex" value="12">女</logic:equal></sex>
<bankAcc><bean:write name="tmp" property="bankAcc"/></bankAcc>
<studentId><bean:write name="tmp" property="studentId"/></studentId>
<identityName><logic:notEqual name="tmp" property="idenNO" value="0"><bean:write name="tmp" property="identityName"/></logic:notEqual></identityName>
<academyName><bean:write name="tmp" property="academyName"/></academyName>
<departmentName><bean:write name="tmp" property="departmantName"/></departmentName>
<className><bean:write name="tmp" property="className"/></className>
<grade><bean:write name="tmp" property="grade"/></grade>
</part>
</logic:iterate>
</personList>
</xml>
<html:html>
<head>
<base href="<%=basePath%>">
<title>查询列表</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="<%=path%>/css/common6.css">
<SCRIPT language='javascript'>
function onQuery()
{
if(document.all.studentId.value.length!=0)
{
if(/[^0-9]+/.test(document.all.studentId.value)==true)
{
alert("学/工号请输入数字!");
return false;
}
}
document.all.method.value = "doQuery";
document.CardUserManagerForm.submit();
}
function createPerson()
{
document.all.method.value = "createPerson";
open('<%= path%>/CardUserManagerAction.do?method=createPerson','_blank');
}
function onReset()
{
if(typeof(document.all.personRadio)=="undefined")
{
alert("表中无记录,无法进行该操作!");
return false;
}
var radioCheck=document.all.personRadio;
var result=false;
var back=false;
var rst="length" in document.all.personRadio;
if(!rst)
{
if(radioCheck.checked==true)
{
result=true;
back=window.confirm("确定要将此项密码重置么?");
if(back==true)
{
document.all.method.value="doReset";
document.all.operate.value=radioCheck.value;
document.CardUserManagerForm.submit();
}
}
}
else
{
for(var i=0;i<radioCheck.length;i++)
{
if(radioCheck[i].checked==true)
{
result=true;
back=window.confirm("确定要将此项密码重置么?");
if(back==true)
{
document.all.method.value="doReset";
document.all.operate.value=radioCheck[i].value;
document.CardUserManagerForm.submit();
}
}
}
}
if(result==false)
alert("请选择一项!");
}
删除
function deletePerson()
{
if(typeof(document.all.personRadio)=="undefined")
{
alert("表中无记录,无法进行该操作!");
return false;
}
var radioCheck=document.all.personRadio;
var result=false;
var back=false;
var rst="length" in document.all.personRadio;
if(!rst)
{
if(radioCheck.checked==true)
{
result=true;
back=window.confirm("确定要删除此项么?");
if(back==true)
{
document.all.method.value="doDelete";
document.all.operate.value=radioCheck.value;
document.CardUserManagerForm.submit();
}
}
}
else
{
for(var i=0;i<radioCheck.length;i++)
{
if(radioCheck[i].checked==true)
{
result=true;
back=window.confirm("确定要删除此项么?");
if(back==true)
{
document.all.method.value="doDelete";
document.all.operate.value=radioCheck[i].value;
document.CardUserManagerForm.submit();
}
}
}
}
if(result==false)
alert("请选择一项!");
}
function updatePerson()
{
if(typeof(document.all.personRadio)=="undefined")
{
alert("表中无记录,无法进行该操作!");
return false;
}
var radioCheck=document.all.personRadio;
var result=false;
var back=false;
var rst="length" in document.all.personRadio;
if(!rst)
{
if(radioCheck.checked==true)
{
result=true;
back=window.confirm("确定要修改此项么?");
if(back==true)
{
document.all.method.value = "updatePerson";
window.open("<%= path%>/CardUserManagerAction.do?method=updatePerson&operate="+radioCheck.value,"_blank");
}
}
}
else
{
for(var i=0;i<radioCheck.length;i++)
{
if(radioCheck[i].checked==true)
{
result=true;
back=window.confirm("确定要修改此项么?");
if(back==true)
{
document.all.method.value = "updatePerson";
window.open("<%= path%>/CardUserManagerAction.do?method=updatePerson&operate="+radioCheck[i].value,"_blank");
}
}
}
}
if(result==false)
alert("请选择一项!");
}
function onChangeAcademy()
{
document.all.method.value = "doSelectAcademy";
document.CardUserManagerForm.submit();
}
function onChangeDepartment()
{
document.all.method.value = "doSelectDepartment";
document.CardUserManagerForm.submit();
}
//上一页
function perPage()
{
var thisPage = document.all.thisPage2.value;
document.all.next.disabled=false;
document.all.next.className = "NextPageBTN";
document.all.last.disabled=false;
document.all.last.className = "LastPageBTN";
if((parseInt(thisPage))==2)
{
document.all.per.disabled=true;
document.all.per.className = "PrePageBTN1";
document.all.first.disabled=true;
document.all.first.className = "FirstPageBTN1";
}
if((parseInt(thisPage))>1)
{
thisPage1.innerHTML=--thisPage;
document.all.thisPage2.value=thisPage;
}
for(var i = 0;i < document.CardUserManagerForm.personRadio.length;i++)
{
document.CardUserManagerForm.personRadio[i].checked=false;
}
table2.previousPage();
}
//下一页
function nextPage()
{
var thisPage=document.all.thisPage2.value;
var pageAll=document.all.pageAll.value;
document.all.per.disabled=false;
document.all.per.className = "PrePageBTN";
document.all.first.disabled=false;
document.all.first.className = "FirstPageBTN";
if((parseInt(thisPage))==(parseInt(pageAll)-1))
{
document.all.next.disabled=true;
document.all.next.className = "NextPageBTN1";
document.all.last.disabled=true;
document.all.last.className = "LastPageBTN1";
}
if((parseInt(thisPage))<(parseInt(pageAll)))
{
thisPage1.innerHTML=++thisPage;
document.all.thisPage2.value=thisPage;
}
for(var i = 0;i < document.CardUserManagerForm.personRadio.length;i++)
{
document.CardUserManagerForm.personRadio[i].checked=false;
}
table2.nextPage();
}
<!--跳转到某一页-->
function jump()
{
document.all.per.disabled=false;
document.all.per.className = "PrePageBTN";
document.all.next.disabled=false;
document.all.next.className = "NextPageBTN";
document.all.first.disabled=false;
document.all.first.className = "FirstPageBTN";
document.all.last.disabled=false;
document.all.last.className = "LastPageBTN";
pageNum=document.all.page.value;
pageAll=document.all.pageAll.value;
if((parseInt(pageNum))>(parseInt(pageAll))||(parseInt(pageNum)<=0))
{
alert("请输入正确的页数!");
document.all.page.value="";
document.all.page.focus();
}
else if(pageNum=="")
{
alert("请输入页数!");
document.all.page.focus();
}
else if((parseInt(pageNum))<=(parseInt(pageAll)))
{
table2.firstPage();
for(var i=1; i<pageNum; i++)
{
table2.nextPage();
}
if(parseInt(pageNum)==1)
{
document.all.per.disabled=true;
document.all.per.className = "PrePageBTN1";
document.all.first.disabled=true;
document.all.first.className = "FirstPageBTN1";
}
if(parseInt(pageNum)==(parseInt(pageAll)))
{
document.all.next.disabled=true;
document.all.next.className = "NextPageBTN1";
document.all.last.disabled=true;
document.all.last.className = "LastPageBTN1";
}
thisPage1.innerHTML = pageNum;
document.all.thisPage2.value=pageNum;
document.all.page.value="";
}
else
{
alert("输入页数不符合规范!");
document.all.page.value="";
document.all.page.focus();
}
}
/首页
function firstPage()
{
document.all.per.disabled=true;
document.all.per.className = "PrePageBTN1";
document.all.first.disabled=true;
document.all.first.className = "FirstPageBTN1";
document.all.next.disabled=false;
document.all.next.className = "NextPageBTN";
document.all.last.disabled=false;
document.all.last.className = "LastPageBTN";
thisPage1.innerHTML=1;
document.all.thisPage2.value=1;
table2.firstPage();
}
/尾页
function lastPage()
{
document.all.per.disabled=false;
document.all.per.className = "PrePageBTN";
document.all.first.disabled=false;
document.all.first.className = "FirstPageBTN";
document.all.next.disabled=true;
document.all.next.className = "NextPageBTN1";
document.all.last.disabled=true;
document.all.last.className = "LastPageBTN1";
thisPage1.innerHTML=document.all.pageAll.value;
document.all.thisPage2.value=document.all.pageAll.value;
table2.lastPage()
}
<!--第一次进入页面,判断"前一页"和"后一页"按钮是否为disabled-->
function init()
{
document.all.per.disabled=true;
document.all.per.className = "PrePageBTN1";
document.all.first.disabled=true;
document.all.first.className = "FirstPageBTN1";
var thisPage=document.all.thisPage2.value;
var pageAll=document.all.pageAll.value;
if((parseInt(thisPage))==(parseInt(pageAll)))
{
document.all.next.disabled=true;
document.all.next.className = "NextPageBTN1";
document.all.last.disabled=true;
document.all.last.className = "LastPageBTN1";
document.all.go.disabled=true;
}
if(<%=(request.getAttribute("doSuccess")!=null)%>)
{
alert("<%=request.getAttribute("doSuccess")%>");
<%request.removeAttribute("doSuccess");%>
}
else if(<%=request.getAttribute("doFail")!=null%>)
{
alert("<%=request.getAttribute("doFail")%>");
<%request.removeAttribute("doFail");%>
}
}
</SCRIPT>
</head>
<body οnlοad="init()">
<!-- 计算分页 -->
<%List personList = (List)request.getAttribute("vo");
int listMax = personList.size();
int rowsPerPage =10;
int pageMax=1;
if(listMax!=0)
{
if(listMax%rowsPerPage == 0)
{
pageMax = listMax/rowsPerPage;
}
else
{
pageMax = listMax/rowsPerPage+1;
}
}
%>
<html:form action='/CardUserManagerAction.do' method="post">
<TABLE align="center" class="ReadOnly" width="100%" cellspacing=0>
<TR class="TrEven">
<TD width="25%">学院:<html:select property="academy" οnchange="onChangeAcademy()">
<html:options collection="academys" property="value" labelProperty="label" />
</html:select>
</TD>
<TD width="25%">系 :<html:select property="department" οnchange="onChangeDepartment()">
<html:options collection="departments" property="value" labelProperty="label" />
</html:select>
</TD>
<TD width="25%">班级:<html:select property = 'classno'>
<html:options collection="classs" property="value" labelProperty="label" />
</html:select>
</TD>
<TD width="25%">年级:<html:select property = 'grade'>
<html:options collection="grades" property="value" labelProperty="label" />
</html:select>
</TD>
<TD width=10> </TD>
</TR>
<TR class="TrEven">
<TD>性别:<html:select property = 'sex'>
<html:options collection="sexs" property="value" labelProperty="label" />
</html:select>
</TD>
<TD>身份:<html:select property = 'identity'>
<html:options collection="identitys" property="value" labelProperty="label" />
</html:select>
</TD>
<TD colspan=3>民族:<html:select property = 'nation'>
<html:options collection="nations" property="value" labelProperty="label" />
</html:select>
</TD>
</TR>
<TR class="TrEven">
<TD>学/工号:<html:text property = 'studentId' />
</td>
<TD colspan=3> 姓名:<html:text property = 'name1' />
</TD>
<TD><html:button styleClass="BTN" property = 'query' value = '查询' onclick = 'onQuery()'/>
</TD>
</TR>
</TABLE>
<HR width = '100%' size = 2>
<TABLE id = 'table2' NAME = 'table2' datasrc="#xmlPersons" datapagesize="<%=rowsPerPage%>" width="100%" align="center" border="black" bordercolor="black" style="background-color:#FFFFFF;border-color:black;border-collapse:collapse;">
<thead class="TrEven">
<tr>
<td colspan="12" height="23">
<table class="TdNewSubHead" height="21" width="100%" >
<tr>
<td align="center">
<font color="white" size="3"> <b>个人信息维护</b><font>
</td>
</tr>
</table>
</td>
</tr>
<tr align="center" class="TdNewSubHead">
<td>
</td>
<td>IC卡号
</td>
<td>姓名
</td>
<td>性别
</td>
<td>银行卡号
</td>
<td>学/工号
</td>
<td>身份
</td>
<td>学院
</td>
<td> 系
</td>
<td>班级
</td>
<td>年级
</td>
</tr>
</thead>
<tr>
<td colspan=11 align="center">
<logic:notPresent name="vo">
没有您要查询的信息!
</logic:notPresent>
<logic:present name="vo">
<logic:empty name="vo">
没有您要查询的信息!
</logic:empty>
</logic:present>
</td>
</tr>
<tr class="TrOdd" align="center">
<logic:present name="vo">
<logic:notEmpty name="vo">
<td width="4%">
<input style="cursor:hand" type="radio" name="personRadio" οnclick="this.value=this.nextSibling.nextSibling.value">
<input type="hidden" datafld="account">
</td>
<td><a style="cursor:hand" target = '_blank' datafld="accounthref"><div datafld="account"/></a></td>
<td><div datafld="name"/></td>
<td><div datafld="sex"/></td>
<td><div datafld="bankAcc"/></td>
<td><div datafld="studentId"/></td>
<td><div datafld="identityName"/></td>
<td><div datafld="academyName"/></td>
<td><div datafld="departmentName"/></td>
<td><div datafld="className"/></td>
<td><div datafld="grade"/></td>
</logic:notEmpty>
</logic:present>
</tr>
<TFOOT>
<tr class="TdNewSubHead">
<td align="left" colspan="11" >
<input class="BTN" type = 'button' name = 'create' value = '新增' onclick = 'createPerson()'/>
<input class="BTN" type = 'button' name = 'deletep' value = '删除' onclick = 'deletePerson()'/>
<input class="BTN" type = 'button' name = 'update' value = '修改' onclick = 'updatePerson()'/>
<input class="BTN" type = 'button' name = 'resetPassword' value = '密码重置' onclick = 'onReset()'/>
<html:hidden property="operate"/>
共 <%=pageMax%> 页 每页 <%=rowsPerPage%> 条
<input class="FirstPageBTN" type='button' name='first' id='first' value="" οnclick="firstPage()">
<input type="button" class="PrePageBTN" id="per" value="" οnclick="perPage()"/>
<span id="thisPage1">1</span>/<span><%= pageMax%></span>
<input type="button" class="NextPageBTN" id="next" value="" οnclick="nextPage()"/>
<input class="LastPageBTN" type='button' name='last' id='last' value="" οnclick="lastPage()">
第 <input type="text" name="page" size="2" class="TdInput"> 页
<input class="BTN" type="button" name="go" value="跳转" οnclick="jump()">
<input class="BTN" type="hidden" name="pageAll" value="<%=pageMax%>">
<input class="BTN" type="hidden" name="thisPage2" value="1">
</td>
</tr>
</TFOOT>
</TABLE>
<html:hidden property='method'/>
</html:form>
</body>
</html:html>