zoukankan      html  css  js  c++  java
  • 人口普查系统--信息修改

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%><%@ page import="java.sql.*"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>修改信息</title>
    </head>
    <body>
    <%
    final String URL = "jdbc:mysql://localhost:3306/test";
    final String USERNAME = "root";
    final String PWD = "12345";
    Connection connection = null;
    Statement  stmt = null;
    ResultSet rs = null ; 
    request.setCharacterEncoding("utf-8") ;
    
    String name=request.getParameter("selname");
    
    try {
    	// a.导入驱动,加载具体的驱动类
    	Class.forName("com.mysql.jdbc.Driver");// 加载具体的驱动类
    	// b.与数据库建立连接
    	connection = DriverManager.getConnection(URL, USERNAME, PWD);
    	stmt = connection.createStatement();
    	
    	
    	String sql = "select * from pucha where name='"+name+"'  " ;
    
    	// 执行SQL
    	rs = stmt.executeQuery(sql);
    	
    	// d.处理结果
    	while(rs.next()) {  
    		String hb=request.getParameter("hubie");
    		String type=rs.getString("htype");
    		String mj=rs.getString("mianji");
    		String fjs=rs.getString("fangjianshu");
    		String hname=rs.getString("name");
    		String id=rs.getString("id");
    		String xb=rs.getString("xingbie");
    		String mz=rs.getString("minzu");
    		String degree=rs.getString("degree");
    		out.print(type+"--"+mj+"--"+fjs+"--"+hname+"--"+id+"--"+xb+"--"+mz+"--"+degree+"--"+hb);
    		
    	}
    } catch (ClassNotFoundException e) {
    	e.printStackTrace();
    } catch (SQLException e) {
    	e.printStackTrace();
    } catch(Exception e) {
    	e.printStackTrace();
    }
    finally {
    	try {
    		 if(stmt!=null) stmt.close();// 对象.方法
    		 if(connection!=null)connection.close();
    	}catch(SQLException e) {
    		e.printStackTrace();
    	}
    }
    
    
    
    %>
    <form action="Bwancheng.jsp">
    <table align="center">
    	<tr><td>请输入要查找的户主姓名<input type="text"name="selname"></td></tr>
    	<tr>
    		<td>身份证号码:</td>
    		<td><input type="text"name="idnumber">请输入13位身份证号码</td>
    	</tr>
    	<tr>
    		<td>性别:</td>
    		<td>
    			<input type="radio"name="xingbie"value="男">男
    			<input type="radio"name="xingbie"value="女">女
    		</td>
    	</tr>
    	<tr>
    		<td>民族:</td>
    		<td><input type="text"name="minzu"></td>
    	</tr>
    	<tr>
    		<td>受教育程度:</td>
    		<td>
    			<select name="degree">
    				<option value="研究生">研究生:</option>
    				<option value="大学本科">大学本科:</option>
    				<option value="大学专科">大学专科:</option>
    				<option value="高中">高中:</option>
    				<option value="小学">小学:</option>
    				<option value="未上过学">未上过学:</option>
    			</select>
    		</td>
    	</tr>
    	<tr>
    		<td><input type="reset"value="重置"></td>
    		<td><input type="submit"value="提交"></td>
    	</tr>
    
    </table>
    </form>
    
    
    </body>
    </html>
    

      

  • 相关阅读:
    PHP危险函数总结学习
    2019网络与信息安全专项赛题解
    BUUCTF平台-web-边刷边记录-2
    SpringCloud-Config 分布式配置中心
    SpringCloud-Gateway 网关路由、断言、过滤
    SpringCloud-Ribbon负载均衡机制、手写轮询算法
    服务注册与发现-Eureka、Consul、Zookeeper的区别
    Docker 私有仓库搭建
    微服务熔断限流Hystrix之流聚合
    微服务熔断限流Hystrix之Dashboard
  • 原文地址:https://www.cnblogs.com/jz-no-bug/p/14229795.html
Copyright © 2011-2022 走看看