jsp第四次作业

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<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">
            <table border="0" align="left">
                <tr height="40">
                    <td>用户名:</td>
                    <td><input type="text" name="user" maxlength="16"
                        onKeyUp="value=value.replace(/[\W]/g,'')">只能输入字母或数字,4-16个字符</td>
                </tr>
                <tr height="40">
                    <td>密 码:</td>
                    <td><input type="password" name="password" maxlength="12"
                        datatype="*6-12">密码长度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="width: 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="提交"></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="width: 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>

猜你喜欢

转载自www.cnblogs.com/xf981107/p/12584153.html
今日推荐