123456789101112131415161718192021222324252627282930313233 |
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8" import="java.sql.*"%>
- <!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=UTF-8">
- <title>查询页面</title>
- </head>
- <body>
- <%
- request.setCharacterEncoding("utf-8");
- String name = request.getParameter("TeaName");
- String url="jdbc:mysql://127.0.0.1:3306/teamessage?serverTimezone=UTC";
- String username = "root";
- String password = "1314";
- Connection conn = DriverManager.getConnection(url,username,password);
- String sql = "select from teachermessage where Name=?";
- PreparedStatement pstmt = conn.prepareStatement(sql);
- pstmt.setString(1,"TeaName");
- int result = pstmt.executeUpdate();
- String msg = "查询失败,单击点击跳转到老师信息页面";
- if(result==1){
- msg = "查询成功,跳转到老师信息页面";
- }
- pstmt.close();
- conn.close();
- %>
- <script>window.alert('<%= msg %>');</script>
- <%
- response.setHeader("Refresh","2;url=TeachMessage.jsp");
- %>
- </body>
- </html>
|