JSP第四次作业(2)

<%@ 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=utf-8">
<title>登录验证</title>
</head>
<body>
  <form action="d.jsp" method="post" name="myform" onSubmit="return checkLogin()">
  <table align="center">
  <tr>
  <td><img src="Snap1.jpg"><div style="position:absolute;left:650px;top:200px;650px;">
  <table width="100%" height="100%" border=0  cellpadding=0 cellspacing=0  >
  <tbody>
  <tr vAlign="top">
  <td width="20%" height="27" align="right" class="bld">用户名:</td>
  <td height="20" align="left"  ><input name="user" type="text" size="30"><br>用户名由字母和数字组成</td>
  </tr>
  <tr vAlign="top">
  <td width="20%" height="27" align="right" class="bld">密码:</td>
  <td height="20" align="left"  ><input name="pwd" type="password" size="30"><br>密码由数字、字母、下划线组成,至少6位</td>
  </tr>
  <tr vAlign="top">
  <td height="27" align="right" class="bld" ></td>
  <td align="left" valign="middle"><a href="#"><input name="submit" type="image" src="login.gif" width="120" height="25" border="0"></a></td>
  </tr>
  </table>
  </div>
  </td>
  </tr>
  </table>
  </form>
</body>
</html>
<%@ 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>
</head>
<body>
<% 
   request.setCharacterEncoding("utf-8");
   String user=request.getParameter("user");
   String pwd=request.getParameter("pwd");
   if(user.equals("lucky")&&pwd.equals("123456")){
       response.sendRedirect("e.jsp");
   }else{
       response.sendRedirect("f.jsp");
   }
   %>
   
</body>
</html>
<%@ 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>
</head>
<body>
你好:lucky
</body>
</html>
<%@ 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>
</head>
<body>
  登录失败
  <br>
  <a href="c.jsp">
  <input type="button" value="重新登录"></a>
</body>
</html>

 

原文地址:https://www.cnblogs.com/lj1221/p/12611693.html