首页 > 代码库 > 模拟操作银行登入页面。。。未连接数据库
模拟操作银行登入页面。。。未连接数据库
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <style> .a { width:390px; height:290px; background-color:#CCC; margin-left:400px; margin-top:10px; } .b{ width :390px; height:55px; background-color:#03C; margin-left:0px; margin-top:0px; position:relative; line-height:55px;text-align:center } .c{ line-height:40px;text-align:center } </style> </head> <body> <div class="a"> <div class="b"><font color="#FFFFFF" >银行登入系统</font> <form action="A.jsp"method="post"> 用户名: <input type="text" name="name" placeholder="请输入用名户名"style=" width:200px; height:40px"/><br> 密码:     <input <input type="password"name="password" placeholder="请输入密码" style=" width:200px; height:40px"/><br><br> <input type="submit" value="http://www.mamicode.com/提交" style=" width:100px; height:40px"/> </form> </div> </div> </body> </html>
<%@page import="java.sql.PreparedStatement"%> <%@page import="java.sql.ResultSet"%> <%@page import="java.sql.Statement"%> <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.Connection"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <% //访问数据库 try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl", "test0816", "123456"); String sql="select * from ATM where name=? and password=?"; PreparedStatement ps= conn.prepareStatement(sql); ps.setString(1, "name"); ps.setString(1, "password"); ResultSet rs = ps.executeQuery(); if(rs.next()) { out.write("登入成功"); } else { out.write("登入失败"); } } catch(Exception e) { e.printStackTrace(); } %> <br> <% String name =request.getParameter("name"); //字符集转码 name=new String (name.getBytes("ISO-8859-1"),"UTF-8"); String password =request.getParameter("password"); out.write("用户名:"+name+"<br>"); out.write("密码:"+password); if(name.equals("张三")) { if(password.equals("123456")) { %> <!-- 账号密码正确跳转登陆页面--> <jsp:forward page="success.jsp"></jsp:forward> <% } else { %> <!-- 账号正确密码错误跳转密码错误提示页面 --> <jsp:forward page="failPassword.jsp"></jsp:forward> <% } } else { %> <!-- 账号错误跳转账号错误提示页面 --> <jsp:forward page="failName.jsp"></jsp:forward> <% } %> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> 跳转登入成功的页面......<br> 登入成功! </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> 用户名输入错误或不存在的页面<br> 用户名不存在! </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> 密码输入错误跳转页面。。。。<br> 密码错误! </body> </html>
模拟操作银行登入页面。。。未连接数据库
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。