课堂测试3

发布时间 2023-05-31 22:04:09作者: 布吉岛???
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>在此处插入标题</title>
</head>
<body>
     <form action="updatezhucexinxi1.jsp" method="get">
<table align="center" border="1" width="500">
<tr align="center">
			<h5>注意:1表示学生,2表示教师,3表示管理员</h5>
			</tr>
			<tr>

				<td>用户名</td>
				<td><input type="text" name="username" /></td>
			</tr>
						
			<tr>

				<td>密码</td>
				<td><input type="text" name="password" /></td>
			</tr>
						<tr>

				<td>身份</td>
				<td><input type="text" name="profession" /></td>
			</tr>
						<tr align="center">

				<td colspan="2"><input type="submit" value="提交" /></td>

			</tr>
</body>
</html>

  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
		<%@ page import="Util.dao"%>
	<%@ page import="Util.util"%>
<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>在此处插入标题</title>
</head>
<body>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
String profession = request.getParameter("profession");
dao.updatezhucexinxi(username,password,profession);
%>
</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1 style="text-align: center;">学生界面</h1>
<center><input type="button" onclick="window.location.href='gerenxinxi.jsp';" value="完善个人基本信息"><br>
<br>
<br>
<center><input type="button" onclick="window.location.href='seexinxi.jsp';" value="查看个人基本信息"><br>
<br>
<br>
<center><input type="button" onclick="window.location.href='updatexinxi.jsp';" value="修改个人基本信息"><br>
<br>
<br>
<center><input type="button" onclick="window.location.href='seechengji.jsp';" value="查询成绩"><br>
<br>
<br>
</body>
</html>

  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ page import="Util.util"%>
	<%@ page import="java.sql.Connection"%> 
	<%@ page import="java.sql.PreparedStatement"%> 
<%@ page import="java.sql.SQLException"%> 
<%@ page import="java.sql.Statement"%> 
<%@ page import="java.sql.ResultSet"%> 
<%@page import="Util.dao" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此处插入标题</title>
</head>
<body>
<jsp:useBean id="util" class="Util.util" scope="page" />
<table border="1"style="text-align:center;">
	         <tr>
	        <td align="center" >姓名</td>
	         <td align="center" >性别</td>
	        <td align="center" >年龄</td>
	        <td align="center" >班级</td>
	        <td align="center" >学号</td>
	        </tr>
<%
Connection connection = util.getConnection();
PreparedStatement ps = null;
try {
	String sql = "SELECT name,sex,age,banji,number FROM xinxi WHERE EXISTS ( SELECT * FROM chengji WHERE xinxi.number = chengji.xuehao AND chengji.`gaoshu`>89 )";
	ps = connection.prepareStatement(sql);
	ResultSet rs = ps.executeQuery();//要用statement类的executeQuery()方法来下达select指令以查询数据库,executeQuery()方法会把数据库响应的查询结果存放在ResultSet类对象中供我们使用。即语句:ResultSet rs=s.executeQuery(sql);
	while(rs.next()){
%>
			 <tr>
			<td><%=(rs.getString("name")) %></td>//获取数据表中的信息
			<td><%=(rs.getString("sex")) %></td>
			<td><%=(rs.getString("age")) %></td>
			<td><%=(rs.getString("banji")) %></td>
			<td><%=(rs.getString("number")) %></td>
			</tr>	
<%
            }
        } catch (Exception e) {
            out.println(e);
        }
    %>
</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="zhuce1.jsp" method="get">
<table align="center" border="1" width="500">
			
			<tr>

				<td>用户名</td>

				<td><input type="text" name="username" /></td>

			</tr>
			<tr>

				<td>密码</td>

				<td><input type="text" name="password" /></td>

			</tr>
			<tr>
        <td>身份:

            <select name="profession">
                <option value="1">学生</option>
                <option value="2">教师</option>
                <option value="3" selected>管理员</option>
            </select>
        </td>
    </tr>
			<tr align="center">

				<td colspan="2"><input type="submit" value="提交" /></td>

			</tr>


</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ page import="Util.dao"%>
	<%@ page import="Util.util"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String profession = request.getParameter("profession");
String username = request.getParameter("username");
String password = request.getParameter("password");
dao.yhzeng(username, password, profession);
%>
</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="Util.dao"%>
<%@ page import="Util.util"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String age = request.getParameter("age");
String banji = request.getParameter("banji");
String number = request.getParameter("number");
dao.updatexinxi(name,sex,age,banji,number);
%>
</body>
</html>