JSP第四次作业

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
      <style type="text/css">
      div{
          text-align: center;
          margin: 0 auto;
      }
      .password{
           width:203px;
      }
      body{
          background: pink;
      }
      .sub{
          width:150px;
      }
      </style>
  </head>
  
  <body>
  <div>
      <h1>用户登录</h1>
      <form action="dologin.jsp" method="post">
          账号:<input type="text" name="uname" class="name"><br>
          密码:<input type="password" name="upassword" class="password"><br>
          <input type="submit" value="登录" class="sub">
      </form>
  </div>
      
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String name=request.getParameter("uname");
    String password=request.getParameter("upassword");
    if(name.equals("zs")&&password.equals("123")){
        request.getRequestDispatcher("ok.jsp").forward(request,response);
    }else{
        request.getRequestDispatcher("no.jsp").forward(request,response);
    }
 %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  
  <body>
      <h1>登陆成功</h1>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  
  <body>
      <h1>登陆失败</h1>
  </body>
</html>

 

posted @ 2021-05-30 13:34  吕清华  阅读(43)  评论(0编辑  收藏  举报