?? get_student.jsp
字號:
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'loginaction.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<body>
<%
request.setCharacterEncoding("GBK");
String key=request.getParameter("key");
Connection con=null;
Statement sqlUpdate;
ResultSet rs;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
}catch(Exception e){
out.print(e);
}
try {
String sql="";
sql="select * from score where 學號='"+key+"'";
System.out.println(sql);
con=DriverManager.getConnection("jdbc:odbc:student","","");
sqlUpdate=con.createStatement();
rs=sqlUpdate.executeQuery(sql);
if(rs.next()){
session.setAttribute("id",rs.getObject(1));
session.setAttribute("name",rs.getObject(2));
session.setAttribute("math",rs.getObject(3));
session.setAttribute("english",rs.getObject(4));
session.setAttribute("physic",rs.getObject(5));
}
System.out.println(session.getAttribute("physic"));
con.close();
}catch(SQLException e1){
out.print(e1);
}finally{
try {
if (con != null) {
con.close();
con = null;
}
} catch (Exception ee) {}
}
response.sendRedirect(path+"/admin/student_edit.jsp");
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -