jsp第四周作业
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ page contentType="text/html"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <form action="tt.jsp" method="post" name="登录"> <h2>登录界面</h2> 账号:<input id="uname" type="text" name="id"> </br> 密码:<input id="upass" type="password" name="password"></br> <input type="submit" value="注册账号"> <input id="login" type="button" value="登录账号"> </form> </body> </html> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ page contentType="text/html"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <% String name = request.getParameter("id"); String password = request.getParameter("password"); if (name.equals("zs") && password.equals("123")) { out.println("我的账号是:" + id); out.println("我的密码是:" + password); } else { out.println("登录失败"); } %> </body> </html>