JSP第三周作业
1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 <%@ page contentType="text/html"%> 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 4 <html> 5 <head> 6 <title>My JSP 'index.jsp' starting page</title> 7 <meta http-equiv="pragma" content="no-cache"> 8 <meta http-equiv="cache-control" content="no-cache"> 9 <meta http-equiv="expires" content="0"> 10 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> 11 <meta http-equiv="description" content="This is my page"> 12 <!-- 13 <link rel="stylesheet" type="text/css" href="styles.css"> 14 --> 15 </head> 16 17 <body> 18 <form action="login.jsp" method="get" name="登录"> 19 <h2>登录界面</h2> 20 账号:<input id="uname" type="text" name="user"> </br> 密码:<input 21 id="upass" type="password" name="psw"></br> 22 <input 23 type="submit" value="注册"> <input id="login" 24 type="button" value="登录"> 25 </form> 26 27 </body> 28 </html> 29 30 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 31 <%@ page contentType="text/html"%> 32 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 33 <html> 34 <head> 35 <title>My JSP 'index.jsp' starting page</title> 36 <meta http-equiv="pragma" content="no-cache"> 37 <meta http-equiv="cache-control" content="no-cache"> 38 <meta http-equiv="expires" content="0"> 39 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> 40 <meta http-equiv="description" content="This is my page"> 41 <!-- 42 <link rel="stylesheet" type="text/css" href="styles.css"> 43 --> 44 </head> 45 46 <body> 47 <% 48 String name = request.getParameter("user"); 49 String password = request.getParameter("psw"); 50 if (name.equals("123456") && password.equals("123456")) { 51 out.println("我的账号是:" + name ); 52 out.println("我的密码是:" + password); 53 } else { 54 out.println("登录失败"); 55 } 56 %> 57 </body> 58 </html>