课堂测试3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!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>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!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>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<%@ 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>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!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>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<%@ 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>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<%@ 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>

posted @   布吉岛???  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
点击右上角即可分享
微信分享提示