本次内容为2019年期中考试的数据添加界面add.jsp和数据接受界面addq.jsp的代码分享
首先是add.jsp
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ page import="R.Renkou"%> 4 <%@ page import="Dao.dao"%> 5 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 6 <html> 7 <head> 8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 9 <title>A</title> 10 </head> 11 <body> 12 13 14 <% 15 //以下语句用于接收客户端传来的参数 16 dao d=new dao(); 17 String hubie =request.getParameter("hubie"); 18 System.out.println("接收成功"); 19 String leixing=request.getParameter("leixing"); 20 System.out.println("接收成功"); 21 String mianji=request.getParameter("mianji"); 22 System.out.println("接收成功"); 23 String fangjianshu=request.getParameter("fangjianshu"); 24 System.out.println("接收成功"); 25 String xingming=request.getParameter("xingming"); 26 System.out.println("接收成功"); 27 String shenfenzhenghao=request.getParameter("shenfenzhenghao"); 28 29 System.out.println("接收成功"); 30 String xingbie=request.getParameter("xingbie"); 31 System.out.println("接收成功"); 32 String minzu=request.getParameter("minzu"); 33 System.out.println("接收成功"); 34 String jiaoyu=request.getParameter("jiaoyu"); 35 System.out.println("接收成功"); 36 if(d.judge(shenfenzhenghao)==0) 37 { 38 response.getWriter().append("身份证号大于13位了!"); 39 %><input type="button" onclick="window.location.href ='addq.jsp'" value="添加界面"/> <% 40 } 41 else 42 { 43 Renkou r=new Renkou(hubie,leixing,mianji,fangjianshu,xingming,shenfenzhenghao,xingbie,minzu,jiaoyu); 44 d.add(r); 45 } 46 %> 47 48 <input style="margin-left:230px;margin-top:90px;width:100px;height:60px" type = "button" value = "点击这里返回" onclick = "window.location.href = 'index.jsp'"> 49 50 51 52 53 </body> 54 </html>
然后是addq.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>人口登记界面</title> </head> <body> <form action="add.jsp" method="get"> <div class="a"> <label>户别:</label> <input type="radio" name="hubie" value="家庭户" checked="checked" />家庭户 <input type="radio" name="hubie" value="集体户" />集体户 </div> <div class="a"> <label>住房类型:</label> <input type="radio" name="leixing" value="家庭住宅" checked="checked" />家庭住宅 <input type="radio" name="leixing" value="集体住所" />集体住所 <input type="radio" name="leixing" value="工作地住所" />工作地住所 <input type="radio" name="leixing" value="其他住宅" />其他住宅 <input type="radio" name="leixing" value="无住宅" />无住宅 </div> <div class="a"> 本户现住房面积:<input type="text" id="sqare" name="mianji" runat="server" maxlength="100" size="10" onblur="if(/[^0-9]/.test(this.value)){alert('Error');}" />平方米 </div> <div class="a"> 本户现住房间数:<input type="text" id="jian" name="fangjianshu" runat="server" maxlength="100" size="10" onblur="if(/[^0-9]/.test(this.value)){alert('Error');}" />间 </div> <div class="a"> 房主姓名:<input type="text" id="owname" name="xingming" /> </div> <div class="a"> 身份证号码:<input type="text" id="idcard" name="shenfenzhenghao" maxlength="18" onKeyUp="value=value.replace(/[\W]/g,'')" /> </div> <div class="a"> <label>性别:</label> <input type="radio" name="xingbie" value="男" checked="checked" />男 <input type="radio" name="xingbie" value="女" />女 </div> <div class="a"> 民族<input type="text" id="zu" name="minzu" /> </div> <div class="form-group"> <label for="education">受教育程度:</label> <select name="jiaoyu" class="form-control" id="education"> <option value="研究生">研究生</option> <option value="大学本科">大学本科</option> <option value="大学专科">大学专科</option> <option value="高中">高中</option> <option value="初中">初中</option> <option value="小学">小学</option> <option value="未上过学">未上过学</option> </select> </div> <div class="a"> <button type="submit" class="b">保 存</button> </div> <div class="a"> <a href="index.jsp">返回</a> </div> </form> </div> </body>
标签:界面,JavaWeb,期中考试,本户,jsp,2019 From: https://www.cnblogs.com/Arkiya/p/16844148.html