<%@ 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 name="myform" method="post" action="b.jsp" > <table align="center"> <tr> <td> <img src="image/Snap1.jpg"><div style="position:absolute; left: 490px; top: 220px; width: 400px;"> <table width="100%" height="100%" border=0 cellPadding=0 cellSpacing=0> <tr vAlign=top> <td width="23%" height="27" align=right class=bld>用户名: </td> <td height="27" align=left><input type="text" size="20" name="u_name"><br>用户名由字母和数字组成</td> </tr> <tr vAlign=top> <td class=bld align=right height=27>密码: </td> <td height="27" align=left><INPUT TYPE="password" size="20" name="u_pswd"><br>密码由字母、数字和下划线组成,至少6位</td> </tr> <tr vAlign=top> <td class=bld align=right height=40> </td> <td align=left valign="middle"><a href="#"><input name="submit" type="image" src="image/login.gif" width="101" height="22" 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=UTF-8"> <title>验证页面</title> </head> <body> <% String name=request.getParameter("u_name"); String pswd=request.getParameter("u_pswd"); if(name.equals("lucky") && pswd.equals("123456")){ out.print("你好,"+name+"!"); request.getRequestDispatcher("c.jsp").forward(request, response); }else{ request.getRequestDispatcher("d.jsp").forward(request, response); } %> </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=UTF-8"> <title>验证成功</title> </head> <body> <h1>验证成功!</h1> <h2>你好: <% String name=request.getParameter("u_name"); out.print(name); %> </h2> </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=UTF-8">
<title>验证失败</title>
</head>
<body>
<h1>验证失败!</h1>
<input type="button" value="重新登录">
</body>
</html>