📄 scoresubmit.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {
font-family: "宋体";
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<%
if(session.getAttribute("userID")== null || session.getAttribute("userID").equals(""))
{
response.sendRedirect("index.jsp");
}
%>
<jsp:include flush="true" page="head.jsp"/><br /><br /><br /><br />
<form name="form1" method="post" action="scoreSubmitList.jsp" >
<%
ResultSet rs = null;
Statement stmt = null;
String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; //驱动程序
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=stuManager";//数据库连接语句
String userID="sa",pwd="sa",sql="";
String courseId = "",courseName = "";
try{
Class.forName(driver);//调入JDBC-ODBC桥的驱动程序
Connection conn = DriverManager.getConnection(url,userID,pwd);//建立与数据的连接
//request对象
stmt = conn.createStatement();//建立Statement的实例,相当于创建一个查询分析器的运行环境
%>
<table width="500" height="104" border="1" align="center" cellpadding="3" cellspacing="1">
<caption>
<span class="style1"> 提交成绩页面
</span>
</caption>
<tr>
<td width="200" height="50" ><div align="center">所修课程:</div></td>
<td><select name="courseId" id="courseId" style="width:133px">
<%
sql= "select * from course";
rs = stmt.executeQuery(sql);
while(rs.next())
{
courseId = rs.getString("courseId");
courseName = rs.getString("courseName");
%>
<option value="<%=courseId%>" ><%=courseName%></option>
<%
}
%>
</select>
</td>
</tr>
<%
}catch(Exception e){
System.out.println(e.getMessage());
}
%>
<tr><th colspan="2"><div align ="center"><input type="submit" name="Submit" value=" 开始提交成绩 "></div></tr>
</table>
</form>
<jsp:include flush="true" page="bottom.jsp"/>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -