⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student_noticelist.jsp

📁 JSP编写的网上教学系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {color: #0000FF; }
#Layer1 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:1;
	left: 16px;
	top: 20px;
}
#Layer2 {
	position:absolute;
	width:306px;
	height:250px;
	z-index:1;
	left: 31px;
	top: 33px;
}
#Layer3 {
	position:absolute;
	width:110px;
	height:251px;
	z-index:2;
	left: 334px;
	top: 33px;
}
#Layer4 {
	position:absolute;
	width:593px;
	height:251px;
	z-index:3;
	left: 441px;
	top: 33px;
}
-->
</style>
</head>

<body>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String driver = "jdbc:odbc:netteach";

//如果是采用windwos验证方式,则采用下面的语句连接
//Connection conn = DriverManager.getConnection(driver);
//如果采用SQL Server验证方式,则采用下面语句,其中sa是用户名,密码为空,如果用户设置了密码,后面的引号中写入密码 
Connection conn = DriverManager.getConnection(driver);
Statement stmt = conn.createStatement();

String uid=(String)session.getAttribute("user_id"); 
String sql="select * from n_record , n_notice ,n_user, n_course where n_record.user_id='"+uid+"'and n_record.course_id=n_notice.course_id and n_record.course_id=n_course.course_id and n_course.user_id=n_user.user_id";
%>


<div id="Layer2">
  <table width="307" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF2F8">
    <tr>
      <td width="90" height="34" class="STYLE3"><div align="center">课程ID</div></td>
      <td width="100" class="STYLE3"><div align="center">课程名称</div></td>
      <td width="109" class="STYLE3"><div align="center">开课学院</div></td>
    </tr></table>
<%//rs为返回结果的ResultSet对象
 ResultSet rs=stmt.executeQuery(sql);
 while(rs.next())
{
 String courseid=(String)rs.getString(3);
 String coursename=(String)rs.getString(13);
 String college=(String)rs.getString(14);
%><tr>
 <table width="307" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF2F8">
 <td width="90" height="34"><div align="center" class="STYLE3"><%=courseid%></div></td>
 <td width="100"><div align="center" class="STYLE3"><%=coursename%></div></td>
 <td width="109"><div align="center" class="STYLE3"><%=college%></div></td>
 </table>
 </tr>
 <%
 }
 rs.close();
 %>

</div>
 
<div id="Layer3">
  <table width="110" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF2F8">
    <tr>
      <td width="110" height="34"><div align="center" class="STYLE3">授课教员</div></td>
    </tr>
  </table>
  <%//rs2为返回结果的ResultSet对象
 ResultSet rs2=stmt.executeQuery(sql);
 while(rs2.next())
{
String teachername=(String)rs2.getString(11);
%>
<tr>
 <table width="110" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF2F8">
  <td width="110" height="34"><div align="center" class="STYLE3"><%=teachername%></div></td>
</table>
</tr>
<%
 }
 rs2.close();
 %>
</div>

 
<div id="Layer4">
  <table width="590" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF2F8">
    <tr>
      <td width="450" height="34" class="STYLE3"><div align="center">课程公告</div></td>
      <td width="140" height="34" class="STYLE3"><div align="center">公告日期</div></td>
    </tr>
  </table>
  <%//rs3为返回结果的ResultSet对象
 ResultSet rs3=stmt.executeQuery(sql);
 while(rs3.next())
{
 	String noticedetail=(String)rs3.getString(4);
 	String noticedate=(String)rs3.getString(5);
%>
<tr>
<table width="590" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF2F8">
<td width="450" height="34"><div align="center" class="STYLE3"><%=noticedetail%></div></td>
<td width="140" height="34"><div align="center" class="STYLE3"><%=noticedate%></div></td>
</table>
</tr>
<%
}
rs3.close();%>
</div>
 
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -