• 2020.11.11收获


    list.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
       <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%
             Object message = request.getAttribute("message");
             Object grade_list = request.getAttribute("grade_list");
             if(message!=null && !"".equals(message)){     
        %>
             <script type="text/javascript">
                  alert("<%=request.getAttribute("message")%>");
             </script>
        <%} %>
        <div align="center">
            <h1 >信息列表</h1>
              <h1> 
            <form action="searchServlet" method="post">
            <select name="cxfs">
      <option  id="cxfs"value ="1">姓名</option>
      <option  id="cxfs" value ="2">性别</option>
      <option  id="cxfs"value="3">受教育程度</option>
      <option  id="cxfs"value="4" >民族</option>
    </select>
                <input type="text" id="value" name="value" placeholder="请输入条件">
                <input type="submit" id="select" name="select" value="查询" />
          </form>
            
            </h1>
            <a href="index.jsp">返回主页</a>
            <table >
                <tr>
                    <td>id</td>
                    <td>户别</td>
                    <td>住房类型</td>
                    <td>面积</td>
                    <td>数目</td>
                    <td>姓名</td>
                    <td>身份证</td>
                    <td>性别</td>
                    <td>民族</td>
                    <td>教育</td>
                    <td align="center" colspan="2">操作</td>
                </tr>
                <c:forEach items="${list}" var="item">
                    <tr>
                        <td>${item.id}</td>
                        <td>${item.hubie}</td>
                        <td>${item.livetype}</td>
                        <td>${item.area}</td>
                        <td>${item.roomnum}</td>
                        <td>${item.name}</td>
                        <td>${item.idcard}</td>
                        <td>${item.sex}</td>
                        <td>${item.nation}</td>
                        <td>${item.education}</td>
                        <td><a href="update.jsp?id=${item.id}&hubie=${item.hubie}&livetype=${item.livetype}&area=${item.area}&roomnum=${item.roomnum}&name=${item.name}&idcard=${item.idcard}&sex=${item.sex}&nation=${item.nation}&education=${item.education}">修改</a></td>
                        <td><a href="servlet?method=delete&id=${item.id}">删除</a></td>
                    </tr>
                </c:forEach>
            </table>
        </div> 
    </body>
                          
    </html>

    update.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>修改</title>
    </head>
    <body>
        <div align="center">
            <h1>修改</h1>
            <a href="index.jsp">返回主页</a>
            <form action="servlet?method=update" method="post">
                <div>
                    id:<input type="text" id="id" name="id" readonly="true"
                        value="${param.id}" />
                </div>
                <div>
                    户别: <input type="radio"  name="hubie" id="hubie" value="家庭户">家庭户
                         <input type="radio"  name="hubie" id="hubie" value="集体户">集体户
                        
                </div>
                <div>
                    住房类型:<input type="text" id="livetype" name="livetype"
                        value="${param.livetype}" />
                        
                </div>
                <div>
                    面积:<input type="text" id="area" name="area"
                        value="${param.area}" />
                </div>
                <div>
                    数目:<input type="text" id="roomnum" name="roomnum"
                        value="${param.roomnum}" />
                </div>
                <div>
                    姓名:<input type="text" id="name" name="name"
                        value="${param.name}" />
                </div>
                <div>
                    身份证:<input type="text" id="idcard" name="idcard"
                        value="${param.idcard}" />
                </div>
                <div>
                    性别:<input type="radio" id="sex" name=sex  value="男" /><input type="radio" id="sex" name="sex" value="女" /></div>
                <div>
                    民族:<input type="text" id="nation" name="nation"
                        value="${param.nation}" />
                </div>
                <div>
                    教育:<select class="form-control" id="education" name="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>
                     <input type="submit" value="修改"  onclick= "return check()" /> 
                </div>
            </form>
        </div>
    </body>
    <script type="text/javascript">
            function check()                        //封装一个<body>中做成点击事件的函数
            {
                if(document.getElementById('area').value=='') {
                      alert('现住房面积不能为空!');
                      document.getElementById('area').focus();
                      isInterger(area);
                      return false;
                     }
                else if(document.getElementById('area').value%1!=0){
                    alert('住房面积不是整数!');
                    return false;
                }
                if(document.getElementById('roomnum').value=='') {
                    alert('现住房间数不能为空!');
                    document.getElementById('roomnum').focus();
                    return false;
                   }
                else if(document.getElementById('roomnum').value%1!=0){
                    alert('现住房间数不是整数!');
                    return false;
                }
                
                if(document.getElementById('idcard').value.length!=18) {
                    alert('身份证号码位数错误!');
                    document.getElementById('idcard').focus();
                    return false;
                   }
    
              
                
            }
            
        </script>
    </html>
  • 相关阅读:
    LeetCode15 3Sum
    LeetCode10 Regular Expression Matching
    LeetCode20 Valid Parentheses
    LeetCode21 Merge Two Sorted Lists
    LeetCode13 Roman to Integer
    LeetCode12 Integer to Roman
    LeetCode11 Container With Most Water
    LeetCode19 Remove Nth Node From End of List
    LeetCode14 Longest Common Prefix
    LeetCode9 Palindrome Number
  • 原文地址:https://www.cnblogs.com/ltw222/p/13965661.html
Copyright © 2020-2023  润新知