1011day-人口普查系统
1、Browse.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 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>Insert title here</title>
</head>
<body>
<%
String sql="select * from test";
Connection conn= DBUtil.getConnection();
PreparedStatement papre=conn.prepareStatement(sql);
ResultSet rs=papre.executeQuery();
while(rs.next()){
out.println(rs.getString("hubie")+"   "+rs.getString("zhufang")+"   "+rs.getString("mianji")+"   "+rs.getString("fangjianshu")+"   "+rs.getString("name")+"   "+rs.getString("ID")+"   "+rs.getString("sex")+"   "+rs.getString("nation")+"   "+rs.getString("educator")+"   ");
out.print("<br />");
}
%>
<form>
<table align="center" border="1">
<tr>
<td>
<input type="submit" formaction="select.jsp" value="返回">
</td>
</tr>
</table>
</form>
</body>
</html>
2、Change.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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>Insert title here</title>
</head>
<body>
<form action="update.jsp">
<table align = "center" border = "1">
<tr>
<td>请输入要修改的户主名称:</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="确定">
</td>
</tr>
</table>
</form>
</body>
</html>
3、delete.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 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>Insert title here</title>
</head>
<body>
<%
String sql="select * from people";
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")+"   "+rs.getString("zhufang")+"   "+rs.getString("mianji")+"   "+rs.getString("fangjianshu")+"   "+rs.getString("name")+"   "+rs.getString("ID")+"   "+rs.getString("sex")+"   "+rs.getString("nation")+"   "+rs.getString("educator")+"   ");
out.print("<br />");
s=false;
}
}
%>
<form action="shanchu">
<table align = "center" border = "1">
<tr>
<td>请再次输入要删除的户主名称:</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="确定">
</td>
</tr>
</table>
</form>
</body>
</html>
4、educator.jsp
<%@ 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="shuchu.jsp" method="get">
<table>
<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>
</table>
</form>
</body>
</html>
5、ErrorPage.jsp
<%@ 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>数据库内无此信息</h1>
<form action="select.jsp" method="get">
<input type="submit" value="返回">
</form>
</body>
</html>