标签:
P142-1.1 登录页面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isErrorPage="true"%> <%@ page import="java.net.URLEncoder" %> <!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="login" method="post" action="P142-1.3.jsp"> 用户名: <input name="uersname type="text" width="30" /> <br> 密码:<input name="password" type="password" width="30" /> <br> <input type="submit" value="登录"/> </form> </form> </body> </html>
P142-1.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> <script type="application/javascript"> setTimeout("window.location=‘P142-1.1.jsp‘",30000); </script> </head> <body> 您输入的用户名或密码有误! <br> <a href="P142-1.1.jsp">30秒后将返回登录页面,或点击此处返回</a> </body> </html>
P142-1.3 用户信息处理
<%@ 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 yonghu = "zxczxc"; String mima = "zxczxc"; String un = request.getParameter("usersname"); String pw = request.getParameter("password"); if(un == yonghu & pw == mima) { out.print("登录成功"); } else { response.sendRedirect("P142-1.2.jsp"); } %> </body> </html>
标签:
原文地址:http://www.cnblogs.com/shadowduke/p/4993361.html