jsp第四周作业

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

</head>

<body>
    <form action="tt.jsp" method="post" name="登录">
        <h2>登录界面</h2>
        账号:<input id="uname" type="text" name="id"> </br> 
        密码:<input id="upass" type="password" name="password"></br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <input type="submit" value="注册账号">&nbsp;&nbsp;
        <input id="login" type="button" value="登录账号">
    </form>

</body>
</html>


<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
    <%
        String name = request.getParameter("id");
        String password = request.getParameter("password");
        if (name.equals("zs") && password.equals("123")) {
            out.println("我的账号是:" + id);
            out.println("我的密码是:" + password);
        } else {
            out.println("登录失败");
        }
    %>
</body>
</html>

 

posted @ 2021-03-29 19:07  Demens  阅读(63)  评论(0编辑  收藏  举报