⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 update_db.jsp

📁 它主要应用于教育系统
💻 JSP
字号:

<%@ page language="java" import="java.sql.*" contentType="text/html;charset=gb2312"%>
<%
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 'update_db.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">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  <jsp:useBean id="test1" scope="application" class="test.Connect_db"/> 
  <body>
    <%
    String user_id=request.getParameter("user_id");
	Connection con=test1.getConnection();
	String name=request.getParameter("name");
	String dept=request.getParameter("dept");
	String phone=request.getParameter("phone");
	String new_name=new String(name.getBytes("ISO-8859-1"),"gb2312");
	String new_dept=new String(dept.getBytes("ISO-8859-1"),"gb2312");
	String new_phone=new String(phone.getBytes("ISO-8859-1"),"gb2312");
	 String sql="update teacher set name=?,dept=?,phone=?  where t_id=?";
		PreparedStatement ps=con.prepareStatement(sql);
		ps.setString(1,new_name);
		ps.setString(2,new_dept);
		ps.setString(3,new_phone);
		ps.setString(4,user_id);
		ps.executeUpdate(); 
		con.close();
		out.print("更新成功。");
    %>
    
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -