<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
    table{
        width: 200px;
        height:200px;
        text-align: center;
    }
</style>
</head>
  <script type="text/javascript">
    function reloadCode()
    {
      var time=new Date().getTime();
      document.getElementById("imagecode").src="<%= request.getContextPath()%>/servlet/ImageServlet?d="+time;
    }
  </script>
<body>
登录<br/>
    <form action="dologin.jsp" name="myform"  "<%= request.getContextPath()%>/servlet/UserServlet" method="post" >
用户名:<input type="text" name="uname"><br/>
密码:<input typut="password" name="upwd"><br/>
 验证码:<input  type="text" name="checkCode"/>
    <a href="javascript:reloadCode();">
      <img alt="验证码" id="imagecode" src="<%= request.getContextPath()%>/servlet/ImageServlet"/>
      看不清楚</a><br>
   <input type="submit" value="登录">
   <form/>
</body>

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<% 

    String name = request.getParameter("uname");

    String pwd  = request.getParameter("upwd");
    
    if(name.equals("zs") && pwd.equals("123"))

        request.getRequestDispatcher("ok.jsp").forward(request, response);

    else

        request.getRequestDispatcher("no.jsp").forward(request, response);


%>
<%@ page landuage="java"  import ="java.util.*" pageEncoding="utf-8"%>
<% 
    request.setCharacterEncoding("utf-8");
    String name = request.getParameter("uname");
    String pwd = request.getParameter("upwd");
    

%>
你注册的姓名是<%=name%><br/>
你注册的密码是<%=pwd%><br/>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
    table{
        width: 200px;
        height:200px;
        text-align: center;
    }
</style>
</head>

<body>
<h1  style="color: green">登录成功</h1>
</body>
</html>

 

 

 

posted on 2021-03-28 16:28  .+  阅读(47)  评论(0编辑  收藏  举报