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

📄 coursemodify.jsp

📁 很不错的选课系统代码 很适合做 毕业论文参考 大家看看把
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!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=gb2312">
<title>课程信息管理</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
body {
	background-image: url(image/bg_002.gif);
}
-->
</style></head>
<script language="JavaScript" type="text/JavaScript">
function check()
{
  if (document.form2.coId.value=="")
  {
    alert("课程号不能为空!");
	document.form2.cId.focus();
	return false;
  }
  else if (document.form2.coName.value=="")
  {
    alert("课程名不能为空!");
	document.form2.coName.focus();
	return false;
  }
  else if (document.form2.credit.value=="")
  {
    alert("学分不能为空!");
	document.form2.credit.focus();
	return false;
  }
  else if (document.form2.period.value=="")
  {
    alert("学时不能为空!");
	document.form2.period.focus();
	return false;
  }
  else if (document.form2.cNumAll.value=="")
  {
    alert("可选人数不能为空!");
	document.form2.cNumAll.focus();
	return false;
  }
}
</script>
<body>
<%
String loginNum=(String)session.getAttribute("lnum");
String name=(String)session.getAttribute("name");
String coId=(String)request.getParameter("coid");
session.setAttribute("lnum",loginNum);
session.setAttribute("name",name);
if(loginNum.equals("3"))
{
%>
<table width="80%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top"><br>
            <br>
            <form name="form2" method="post" action="courseMod.jsp" onsubmit="return check()">
              <table width="350" border="0" align="center" cellpadding="0" cellspacing="2" class="border">
                <tr bgcolor="#999999" class="title">
                  <td height="25" colspan="2" align="center"><strong>修改课程</strong></td>
                </tr>
                
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>课程号:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="coId" type="text" id="coId" size="20" maxlength="30" value="<%=coId%>" readonly="false">
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>课程名:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="coName" type="text" id="coName" size="20" maxlength="30">
                  </div></td>
                </tr>
				<tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>所属院系:</strong></div></td>
                  <td width="218" bgcolor="#E3E3E3">
                    <div align="left">
                      <select name="depName">
                        <%
					try{
	Connection connd=null;
	Statement stmtd=null;
	ResultSet rsd=null;
	String dName=null;
	String dId=null;
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	connd=DriverManager.getConnection("jdbc:odbc:xk","sa","");
	String sqld="select * from department";
	stmtd=connd.createStatement();
	rsd=stmtd.executeQuery(sqld);
	while(rsd.next())
	{
		dId=rsd.getString("dId");
		dName=rsd.getString("dName");
		
		out.print("<option value='"+dId+"'>"+dName+"</option>");
	}
	rsd.close();connd.close();stmtd.close();}
	catch(Exception e){out.print(e);}
	%>
                      </select>
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>教师:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <select name="tId" id="tId">
                        <%
					try{
	Connection connd=null;
	Statement stmtd=null;
	ResultSet rsd=null;
	String tName=null;
	String tId=null;
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	connd=DriverManager.getConnection("jdbc:odbc:xk","sa","");
	String sqlt="select tId,tName from teacher";
	stmtd=connd.createStatement();
	rsd=stmtd.executeQuery(sqlt);
	if(rsd.next())
	{
		tId=rsd.getString("tId");
		tName=rsd.getString("tName");
		
		out.print("<option value='"+tId+"'>"+tName+"</option>");
	}
	rsd.close();connd.close();stmtd.close();}
	catch(Exception e){out.print(e);}
	%>
                      </select>
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>学分:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="credit" type="text" id="credit" size="20" maxlength="30">
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>学时:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="period" type="text" id="period" size="20" maxlength="30">
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>上课时间:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="cTime" type="text" id="cTime" size="20" maxlength="30">
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>上课地点:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="cPlace" type="text" id="cPlace" size="20" maxlength="30">
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td width="126" height="22" bgcolor="#C0C0C0"><div align="left"><strong>可选人数:</strong></div></td>
                  <td bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="cNumAll" type="text" id="cNumAll" size="20" maxlength="30">
                  </div></td>
                </tr>
                <tr class="tdbg">
                  <td height="22" align="center" bgcolor="#C0C0C0">&nbsp; </td>
                  <td height="22" align="center" bgcolor="#E3E3E3">
                    <div align="left">
                      <input name="Add" type="submit" value=" 修 改 ">
                  </div></td>
                </tr>
              </table>
            </form></td>
  </tr>
</table>
<%
}
else
{out.println("请先登陆.....");
out.print("<a href=../index.jsp>登陆页面</a>");
}
%>
</body>
</html>

⌨️ 快捷键说明

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