login.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>register</title> <style type="text/css" ></style> </head> <body> <form action="login.jsp" method="post"> 用户名:<input type="text" name="uname"><br> 密 码:<input type="password" name="upwd"><br> 验证码: <input type="text" name="code_text" size="3" /> <img src="/ServletDemoProject/servlet/GetVerificationCodeServlet" id="img_src" /> <a href="javascript:_change_verity_code()">换一张</a> <br> <input type="submit" value="提交"> </form> </body> </html> succes.jsp <%@ page contentType="text/html" %> <%@ page pageEncoding="utf-8" %> <html> <body bgcolor=cyan> <p style="font-family:黑体;font-size:36;color:bule"> <% String uname = request.getParameter("uname"); String upwd = request.getParameter("upwd"); if(uname.equals("zs")&&upwd.equals("123")){ out.println("登录成功"); %> 用户名为:<%=uname %><br> 密码为:<%=upwd %> <% }else{ out.println("登录失败"); } %> </body> </html>