zoukankan      html  css  js  c++  java
  • 1013day人口普查系统

    1、shuchu.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="com.edu.ia.DBUtil" %>
    <%@page import = "java.sql.*" %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    String sql="select * from test";
    Connection conn= DBUtil.getConnection();
    PreparedStatement papre=conn.prepareStatement(sql);
    ResultSet rs=papre.executeQuery();
    String n=request.getParameter("name");
    String s=request.getParameter("sex");
    String i=request.getParameter("nation");
    String e=request.getParameter("educator");
    boolean p=true;
    if(n!=null){
    while(rs.next()){
    if(n.equals(rs.getString("name"))){
    out.println(rs.getString("hubie")+" &nbsp "+rs.getString("zhufang")+" &nbsp "+rs.getString("mianji")+" &nbsp "+rs.getString("fangjianshu")+" &nbsp "+rs.getString("name")+" &nbsp "+rs.getString("ID")+" &nbsp "+rs.getString("sex")+" &nbsp "+rs.getString("nation")+" &nbsp "+rs.getString("educator")+" &nbsp ");
    out.print("<br />");
    p=false;
    }
    }
    }
    else if(s!=null){
    while(rs.next()){
    if(s.equals(rs.getString("sex"))){
    out.println(rs.getString("hubie")+" &nbsp "+rs.getString("zhufang")+" &nbsp "+rs.getString("mianji")+" &nbsp "+rs.getString("fangjianshu")+" &nbsp "+rs.getString("name")+" &nbsp "+rs.getString("ID")+" &nbsp "+rs.getString("sex")+" &nbsp "+rs.getString("nation")+" &nbsp "+rs.getString("educator")+" &nbsp ");
    out.print("<br />");
    p=false;
    }
    }
    }
    else if(i!=null){
    while(rs.next()){
    if(i.equals(rs.getString("nation"))){
    out.println(rs.getString("hubie")+" &nbsp "+rs.getString("zhufang")+" &nbsp "+rs.getString("mianji")+" &nbsp "+rs.getString("fangjianshu")+" &nbsp "+rs.getString("name")+" &nbsp "+rs.getString("ID")+" &nbsp "+rs.getString("sex")+" &nbsp "+rs.getString("nation")+" &nbsp "+rs.getString("educator")+" &nbsp ");
    out.print("<br />");
    p=false;
    }
    }
    }
    else if(e!=null){
    while(rs.next()){
    if(e.equals(rs.getString("educator"))){
    out.println(rs.getString("hubie")+" &nbsp "+rs.getString("zhufang")+" &nbsp "+rs.getString("mianji")+" &nbsp "+rs.getString("fangjianshu")+" &nbsp "+rs.getString("name")+" &nbsp "+rs.getString("ID")+" &nbsp "+rs.getString("sex")+" &nbsp "+rs.getString("nation")+" &nbsp "+rs.getString("educator")+" &nbsp ");
    out.print("<br />");
    p=false;
    }
    }
    }
    %>
    <% if(p){
    %>
    <jsp:forward page = "ErrorPage.jsp"></jsp:forward>
    <%
    }
    %>
    <form action="select.jsp" method="get">
    <input type="submit" value="返回">
    </form>
    </body>
    </html>

    2、update.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="com.edu.ia.DBUtil" %>
    <%@page import = "java.sql.*" %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    String sql="select * from test";
    Connection conn= DBUtil.getConnection();
    PreparedStatement papre=conn.prepareStatement(sql);
    ResultSet rs=papre.executeQuery();
    String n=request.getParameter("name");
    boolean s=true;
    session.setAttribute("name",n);
    while(rs.next()){
    if(n.equals(rs.getString("name"))){
    out.println(rs.getString("hubie")+" &nbsp "+rs.getString("zhufang")+" &nbsp "+rs.getString("mianji")+" &nbsp "+rs.getString("fangjianshu")+" &nbsp "+rs.getString("name")+" &nbsp "+rs.getString("ID")+" &nbsp "+rs.getString("sex")+" &nbsp "+rs.getString("nation")+" &nbsp "+rs.getString("educator")+" &nbsp ");
    out.print("<br />");
    s=false;
    }
    }
    %>
    <% if(s){
    %>
    <jsp:forward page = "ErrorPage.jsp"></jsp:forward>
    <%
    }
    %>
    <form action="xiugai" method="get">
    <table>
    <tr>
    <td>身份证号码</td>
    <td>
    <input type="text" name="ID" pattern="[0-9]{5}" title="只能输入数字或最后一位为X">
    </td>
    </tr>
    <tr>
    <td>性别</td>
    <td>
    <input type="radio" name="sex" value="男">男
    <input type="radio" name="sex" value="女">女
    </td>
    </tr>
    <tr>
    <td>民族</td>
    <td>
    <input type="text" name="nation">
    </td>
    </tr>
    <tr>
    <td>受教育程度</td>
    <td>
    <input type="text" name="educator" list="elist">
    <datalist id="elist">
    <option>研究生</option>
    <option>大学本科</option>
    <option>大学专科</option>
    <option>高中</option>
    <option>初中</option>
    <option>小学</option>
    <option>未上过学</option>
    </datalist>
    </td>
    </tr>
    <tr align="center">
    <td colspan="2">
    <input type="submit" value="提交">
    </td>
    <td colspan="2">
    <input type="submit" value="返回" formaction="select.jsp">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  • 相关阅读:
    【LeetCode OJ】Remove Element
    【LeetCode OJ】Remove Duplicates from Sorted Array
    【LeetCode OJ】Swap Nodes in Pairs
    【LeetCode OJ】Merge Two Sorted Lists
    【LeetCode OJ】Remove Nth Node From End of List
    【LeetCode OJ】Two Sum
    【LeetCode OJ】Majority Element
    最长公共子序列问题
    php fopen与file_get_contents的区别
    PHP 技巧集合
  • 原文地址:https://www.cnblogs.com/lx06/p/14165115.html
Copyright © 2011-2022 走看看