📄 getuteacher.jsp
字号:
<%@ page language="java" import="java.sql.*"
contentType="text/html; charset=gb2312" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<jsp:useBean id="teacher" scope="page" class="edu.TeacherBean" />
<jsp:useBean id="uteacher" scope="page" class="edu.UteacherBean" />
<title>优秀教师管理</title>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
-->
</style>
<script language=JavaScript>
function getconfirm()
{
if (confirm("确定要将该教师从优秀名单中移除?"))
return ture;
else
return false;
}
function openWindow(url){
window.open(url,'', 'height=200, width=300, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
</script>
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
<!--
.STYLE2 {
font-size: 14px;
font-weight: bold;
}
.STYLE3 {color: #FF0000}
-->
</style>
</head>
<body>
<%
int allrow=0,pagesize=10, intpage=1;
String name=null;
String sort="";
try{
sort=session.getAttribute("sort").toString();
}catch(NullPointerException e){}
if(!sort.equals("admin"))
response.sendRedirect("error_ad.jsp");
try{
intpage=Integer.valueOf(request.getParameter("intpage")).intValue();
}catch(NumberFormatException e){}
ResultSet rs=uteacher.getCount();
if(rs.next())
allrow=rs.getInt(1);
int allpage = (allrow+pagesize-1) / pagesize;
// 调整待显示的页码
if(intpage>allpage) intpage = allpage;
if(intpage<1) intpage = 1;
int startrow=(intpage-1)*pagesize;
uteacher.setStartpage(startrow);
uteacher.setPagesize(pagesize);
%>
<table width="500" height="30" border="0" align="center" cellspacing="1">
<tr>
<td>
<div align="center"><font size="+2" face="华文行楷">优秀教师</font></div>
</td>
</tr>
</table>
<table width="500" border="0" align="center" cellspacing="1"
bordercolor="#CCCCCC" bgcolor="E7F2FF">
<tr>
<td height="25" width="34%" colspan="2" bgcolor="#FF0000">
<div align="center" class="STYLE1 STYLE1 STYLE2">用户名</div>
</td>
<td height="25" width="33%" colspan="2" bgcolor="#FF0000">
<div align="center" class="STYLE1 STYLE2">修改简介</div>
</td>
<td height="25" width="33%" colspan="2" bgcolor="#FF0000">
<div align="center" class="STYLE1 STYLE2">从名单中移除</div>
</td>
</tr>
<%
rs=uteacher.getTeacher();
while(rs.next()){
int id=rs.getInt("id");
int t_id=rs.getInt("t_id");
ResultSet rss=teacher.getTeachers(t_id);
if(rss.next())
name=rss.getString("t_teacher");
rss.close();
%>
<tr>
<td colspan="2" bgcolor="#F7F7F7">
<div align="center"><strong><a
href="show_ad.jsp?sort=teacher&userid=<%=t_id %>"><%=name%></a></strong></div>
</td>
<td colspan="2" bgcolor="#F7F7F7">
<div align="center"><a
href="javascript:openWindow('modifyuteacher.jsp?id=<%=id%>')">修改</a></div>
</td>
<td colspan="2" bgcolor="#F7F7F7">
<div align="center"><a
href="Servletuteacher?action=delete&id=<%=id%>"
onClick="return getconfirm()">移除</a></div>
</td>
</tr>
<%}rs.close(); %>
</table>
<div align="center">
<table width="500" border="0">
<tr>
<td width="35%" height="30">
<div align="center">共<span class="STYLE3"><%=allrow %></span>条记录 当前第<span class="STYLE3"><%=intpage %></span>页/共<span class="STYLE3"><%=allpage %></span>页</div></td>
<td width="65%"><div align="center"><a href="getuteacher.jsp">首页</a>
<%int tenpage=((int)(intpage/10))*10;
if(intpage-10>0) {%>
<a href="getuteacher.jsp?intpage=<%=intpage-10%>">上十页</a>
<%} %>
<a href="getuteacher.jsp?intpage=<%=intpage-1%>">上一页</a>
<%if(tenpage+10<=allpage){
for(int i=1;i<=10;i++){%>
<a href="getuteacher.jsp?intpage=<%=tenpage+i %>"><%=tenpage+i %></a>
<%}}if(tenpage+10>allpage){
for(int i=0;i+tenpage<=allpage;i++){%>
<a href="getuteacher.jsp?intpage=<%=tenpage+i %>"><%=tenpage+i %></a>
<%}} %>
<a href="getuteacher.jsp?intpage=<%=intpage+1%>">下一页</a>
<%if(intpage+10<=allpage) {%>
<a href="getuteacher.jsp?intpage=<%=intpage+10%>">下十页</a>
<%} %>
<a href="getuteacher.jsp?intpage=<%=allpage%>">尾页</a></div></td>
</tr>
</table></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -