<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="dao.sc" %>
<%@ page import="bean.course" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.ResultSet"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1 align="center">学生选课系统</h1>
欢迎 <font color="red" size="5"><%=session.getAttribute("sname") %></font> 登录选课网
<p>
<table width="720" border="1" align="center" cellpadding="0" cellspacing="0">
<tr align="center" bgcolor="#CCFFFF">
<td width="80" height="30">课号</td>
<td width="80" height="30">课程名</td>
<td width="80" height="30">课时</td>
<td width="80" height="30">学分</td>
<td width="80" height="30">任课教师</td>
<td width="80" height="30">上课时间</td>
<td width="80" height="30">计划人数</td>
<td width="80" height="30">线选人数</td>
<td width="80" height="30">选课</td>
</tr>
<tr align="center">
<%
String sql;
sql="select * from course";
sc t=new sc();
List<course> list=t.xiancourse(sql);
course cou=new course();
for (int i=0;i<list.size();i++)
{
cou=list.get(i);
%>
<td width="80" height="30"><%=cou.getCid()%></td>
<td width="80" height="30"><%=cou.getCname()%></td>
<td width="80" height="30"><%=cou.getKs()%></td>
<td width="80" height="30"><%=cou.getXf()%></td>
<td width="80" height="30"><%=cou.getTeacher()%></td>
<td width="80" height="30"><%=cou.getCtime()%></td>
<td width="80" height="30"><%=cou.getCcount()%></td>
<%
String sql1;
int s=0;
sql1="select count(sid) as scou from score where cid='"+cou.getCid()+"'";
ResultSet rs=t.selsc(sql1);
if(rs.next())
{
s=rs.getInt("scou");
%>
<td width="80" height="30"><font color="red"><b><%=s %></b></font></td>
<%
}
else
{
s=0;
%>
<td width="80" height="30"><font color="red"><b><%=s %></b></font></td>
<%
}
%>
<%
if(s<cou.getCcount())
{
%>
<td width="80" height="30"><a href="selcourse.jsp?cid<%=cou.getCid()%>">选课</a></td>
<%
}
else
{
%>
<td width="80" height="30">已选满</td>
<%
}
%>
</tr>
<%
}
%>
</table>
<p></p>
<center><jsp:include flush="true" page="xiansel.jsp"></jsp:include></center>
</body>
</html>
评论0