📄 studentscoreinfo.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.sun.rowset.*" %>
<%@ page import="DataBaseConnection.OracleConnection" %>
<%
//获取连接对象和语句对象
Connection conn = null;
Statement stmt = null;
CachedRowSetImpl rowSet;
String user = "sox";
String password = "123";
OracleConnection oc = new OracleConnection( user, password );
try{
conn = oc.getConnection();
stmt = conn.createStatement();
}
catch( SQLException e ){ System.out.println( e.getMessage()+"374" ); }
String sql="select student.编号,student.姓名,score.语文,score.数学,score.英语,score.综合,score.X科,score.总分 from student,score where student.编号=score.号码 order by student.编号";
ResultSet rs = stmt.executeQuery( sql );
rowSet=new CachedRowSetImpl();
rowSet.populate(rs);
conn.close();
rowSet.last();
int m=rowSet.getRow();
int n=15;
int pageAllCount=((m%n)==0)?(m/n):(m/n+1);
%>
<center>
<br> <font size=+3>考生成绩</font>
<table border="1">
<tr bgcolor="#FFCC99">
<th nowrap width=100>编号</th>
<th nowrap width=100>姓名</th>
<th nowrap width=100>语文</th>
<th nowrap width=100>数学</th>
<th nowrap width=100>英语</th>
<th nowrap width=100>综合</th>
<th nowrap width=100>X科</th>
<th nowrap width=100>总分</th>
</tr>
<% int pag=1;
String str=request.getParameter("showPage");
if(str==null){pag=1;}
else{byte b[]=str.getBytes("ISO-8859-1");
str=new String(b);
pag=Integer.parseInt(str);
if (pag<=0){pag=pageAllCount;}
else if(pag>pageAllCount){pag=1;}
else{pag=Integer.parseInt(str);}
}
rowSet.absolute((pag-1)*15+1);
for(int i=1;i<=15;i++)
{
out.print(
"<tr> <td>"+rowSet.getString(1)+"</td><td>"+rowSet.getString(2)+"</td><td>"+rowSet.getString(3)+"</td><td>"+rowSet.getString(4)+
"</td><td>"+rowSet.getString(5)+"</td><td>"+rowSet.getString(6)+"</td><td>"+rowSet.getString(7)+"</td><td>"+rowSet.getString(8)+"</td></tr>"
);
if(rowSet.isLast()){break;}else{rowSet.next();}
}
%>
</table>
<BR>共有<%=m%>条学生信息
<BR>当前显示第<Font color=blue><%=pag%></Font>页,
共有<Font color=blue><%=pageAllCount%></Font>页,
单击“前一页”或“下一页”按钮查看记录
<TABLE>
<TR><TD><FORM action="">
<Input type=hidden name="showPage" value="<%=pag-1%>">
<Input type=submit name="g" value="前一页">
</FORM>
</TD>
<TD><FORM action="">
<Input type=hidden name="showPage" value="<%=pag+1%>">
<Input type=submit name="g" value="后一页">
</FORM>
</TD>
<TD><FORM action="">
输入页码:<Input type=text name="showPage" size=5>
<Input type=submit name="g" value="提交">
</FORM>
</TD>
</TR>
</TABLE>
</center>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -