JSP课后作业(一)简单注册界面

// register.html

<%@ page contentType = "text/html;charset = utf-8"%>
<html>
    <body>
        <form action = "output.jsp" method = "post" name = "form1">
            <font size = "4">注册信息</font>
            <table width = "700"  border = "1">
                <tr>
                    <td><font size = "3">姓名:</font></td>
                    <td><input type = "text" name = "username" size = "18"></td></tr>
                <tr>
                    <td><font size = "3">年龄:</font></td>
                    <td><input type = "text" name = "age" size = "18"></td></tr>
                <tr>
                    <td><font size = "3">性别:</font></td>
                    <td><input type = "radio" name = "radio" value = "男" checked="checked">
                        <font size = "3"></font>
                        <input type = "radio" name = "radio" value = "女">
                        <font size = "3"></font>
                    </td>
                </tr>
                </table><br>
                <input type = "submit" name = "submit" value = "注册" >
        </form>
   </body>
 </html>      

// output.jsp

<%@ page contentType = "text/html;charset = utf-8" %>
<html>
    <body>
        <% request.setCharacterEncoding("iso-8859-1");%>
        用户注册信息<br>
        <%if(request.getParameter("username").hashCode() == "admin".hashCode()){%>
        欢迎您,管理员!
        <%} else{%>
                用户名:<%= request.getParameter("username") %><br>
        年龄:<%= request.getParameter("age") %><br>
        性别:<%= request.getParameter("radio") %><br>
        注册成功!
        <%} %>
    </body>
</html>

 

posted @ 2017-11-15 10:25  douzujun  阅读(453)  评论(0)    收藏  举报