JSP第四周
1.登录功能 用户名zs 密码123 登录成功 要求 有验证码功能 界面要美观 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <% String str = request.getParameter("address"); String pwd = request.getParameter("key"); if (null != str) { if (str.equals("jhn") && pwd.equals("200712")) { pageContext.forward("login.jsp"); } else { out.println("您输入的账号或密码有误,请确认后重新输入!"); } } %> <html> <head> <form action="" method="post"><br> 账号: <input type="text" name="address" size="15"><br> 密码: <input type="password" name="key" size="16.95"><br> 验证码: <input type="text" name="7564" size="12"> <img id="yzmtp" src="img/2.jpg" width="80px" height="30px"/>换一张<br> <input type="submit" value="登录" name="login"> </form> </head> <body style="background:url(img/11.jpg)"> </body> </html> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body style="background:url(img/11.jpg)"> welcome <br> </body> </html>