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="lo.jsp" method="post" name="登录"> <h2>登录界面</h2> 账号:<input id="uname" type="text" name="name"> </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("name"); String password = request.getParameter("password"); if (name.equals("zs") && password.equals("123")) { out.println("我的账号是:" + name); out.println("我的密码是:" + password); } else { out.println("登录失败"); } %> </body> </html>