• jsp第四次作业


    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    <html>
    <head>
    <script type="text/javascript">
        function Check() {
            var password = document.myform.password.value;
            var passwordok = document.myform.passwordok.value;
            var user = document.myform.user.value;
            var user1 = /^[A-Za-z0-9]+$/;
            var user2 = /^w{4,16}$/
            var password1 = /^w{6,12}$/
            if (!user1.test(user)) {
                alert("用户名格式错误,请重新输入");
                document.myform.user.focus();
                return false;
            }
            if (!user2.test(user)) {
                alert("用户名长度错误,请重新输入");
                document.myform.user.focus();
                return false;
            }
                if (!password1.test(password)) {
                alert("密码长度错误,请重新输入");
                document.myform.password.focus();
                return false;
            }    
            if (password != passwordok) {
                alert("密码不一致,请重输入");
            }
        }
    </script>
    <style>
    div {
        font-size: 30px;
    }
    </style>
    </head>
    <body background="image/beijing.jpg">
        <div style="margin-left: 200px" class="div">
            <p style="margin-left: 140px">注册页面</p>
            <form action="index2.jsp" method="post" name="myform">
                <table border="0" align="left">
                    <tr height="40">
                        <td>用户名:</td>
                        <td><input type="text" name="user">只能输入字母或数字,4-16个字符</td>
                    </tr>
                    <tr height="40">
                        <td>密 码:</td>
                        <td><input type="password" name="password">密码长度6-12位</td>
                    </tr>
                    <tr height="40">
                        <td>确认密码:</td>
                        <td><input type="password" name="passwordok">
                        </td>
                    </tr>
                    <tr height="40">
                        <td>性 别:</td>
                        <td><input type="checkbox" value="男" name="sex"><input
                            type="checkbox" value="女" name="sex"></td>
                    </tr>
                    <tr height="40">
                        <td>电子邮件地址:</td>
                        <td><input type="email" name="email">
                        </td>
                    </tr>
                    <tr height="40">
                        <td>出生日期:</td>
                        <td><input type="text" name="year" style=" 10%"><select name="month">
                                <option value="" hidden="">请选择</option>
                                <%
                                    for (int i = 1; i <= 12; i++) {
                                %>
                                <option value="<%=i%>"><%=i%></option>
                                <%
                                    }
                                %>
    
                        </select><select name="date">
                                <option value="" hidden="">请选择</option>
                                <%
                                    for (int i = 1; i <= 31; i++) {
                                %>
                                <option value="<%=i%>"><%=i%></option>
                                <%
                                    }
                                %>
    
                        </select></tr>
                    <tr height="40">
                        <td colspan="1" align="right"><input type="submit"
                            name="Submit" value="提交" onfocus="Check()"></td>
                        <td colspan="1" align="center"><input type="reset"
                            name="reset" value="取消"></td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
    </html>
    <%@page import="com.sun.xml.internal.txw2.Document"%>
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    <html>
    <head>
    
    </head>
    
    <body background="image/beijing.jpg" style="font-size:20px">
        <%
            request.setCharacterEncoding("utf-8");
            String user = request.getParameter("user");
            String password = request.getParameter("password");
            String sex = request.getParameter("sex");
            String email = request.getParameter("email");
            String year = request.getParameter("year");
            String month = request.getParameter("month");
            String date = request.getParameter("date");
            request.setAttribute("user", user);
        %>
    
        <table border="1" align="left" style=" 30%;height: 50%" >
            <tr height="40">
                <td>用户名:</td>
                <td><%=user%></td>
            </tr>
            <tr  height="40">
                <td>密码:</td>
                <td><%=password%></td>
            </tr>
            <tr  height="40">
                <td>性别:</td>
                <td><%=sex%></td>
            </tr>
            <tr  height="40">
                <td>邮箱:</td>
                <td><%=email%></td>
            </tr>
            <tr  height="40">
                <td>出生年月日:</td>
                <td><%=year%><%=month%><%=date%></td>
            </tr>
        </table>
    
    </body>
    </html>

  • 相关阅读:
    【ArcGIS 10.2新特性】ArcGIS 10.2 for Desktop 新特性(二)
    手势(Gesture)的增加和识别
    [转]C#自定义开关按钮控件--附带第一个私活项目截图
    当年的试用期周工作心得
    FREESWITCH SEESION
    基于三星ARM9(S3C2410)的交通违章抓拍系统的开发
    Apache Kafka: Next Generation Distributed Messaging System---reference
    How and Why Unsafe is Used in Java---reference
    基于keepalived对redis做高可用配置---转载
    Java获取真实的IP地址--转载
  • 原文地址:https://www.cnblogs.com/xf981107/p/12585117.html
Copyright © 2020-2023  润新知