⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transfer.jsp

📁 一个简单的银行管理系统
💻 JSP
字号:
<%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%@page import="java.sql.*"%><%--The taglib directive below imports the JSTL library. If you uncomment it,you must also add the JSTL library to the project. The Add Library... actionon Libraries node in Projects view can be used to add the JSTL 1.1 library.--%><%--<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> --%><!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>转帐</title>    </head>    <body background="D:/YJ/YJ1.23/NetBank/background/cat.gif">    <%        String loginID = (String)session.getAttribute("userName");        String accountID = "";        String aimID = " "+(String)request.getParameter("aimIDField");        String transferMoney = (String)request.getParameter("moneyField");        String password = (String)request.getParameter("passwordField");        int money = Integer.parseInt(transferMoney);                String dbUrl = "jdbc:odbc:afei";        String user = "scott";        String dbPassword = "tiger";        try        {            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");            Connection conn = DriverManager.getConnection(dbUrl,user,dbPassword);            String sql1 = "Select accountID from netMember where loginID='"+loginID+"'";            Statement stat = conn.createStatement();            ResultSet result1 = stat.executeQuery(sql1);            if(result1.next())            {                accountID = result1.getString("accountID");            }            String sql3 = "Select * from deAccount where accountID='"+accountID+"' and accountType='CU'";            ResultSet result3 = stat.executeQuery(sql3);            if(!result3.next())            {                out.println("您登录所关联的帐号是定期帐号,不允许转帐!");        %>            <meta http-equiv="refresh" content="2; URL=Transfer.html">        <%                }            else            {                String sql4 = "Select * from deAccount where accountID='"+aimID+"' and accountType='CU'";                ResultSet result4 = stat.executeQuery(sql4);                if(!result4.next())                {                    out.println("您的目的帐号是定期帐号,不允许转帐!");        %>            <meta http-equiv="refresh" content="2; URL=Transfer.html">        <%                    }                else                {                    String sql2 = "Select * from deAccount where accountID='"+accountID+"' and accountPassword='"+password+"'";                    ResultSet result2 = stat.executeQuery(sql2);                    if(!result2.next())                    {                        out.println("密码错误,请重新输入!");         %>                    <meta http-equiv="refresh" content="2; URL=Transfer.html">        <%                    }                    else                    {                        String sql5 = "Select * from deAccount where accountID='"+accountID+"' and accountPassword='"+password+"' and accountSum >"+money;                        ResultSet result5 = stat.executeQuery(sql5);                        if(!result5.next())                        {                            out.println("您输入的帐户余额不足,请重新输入!");          %>                    <meta http-equiv="refresh" content="2; URL=Transfer.html">         <%                        }                        else                        {                            CallableStatement proc = conn.prepareCall("{ call NetTransMoney(?,?,?) }");                            proc.setString(1, accountID);                            proc.setString(2, aimID);                             proc.setInt(3,money);                            proc.execute();                            proc.close();                            conn.close();                            out.println("祝贺你,转帐成功");                        }                    }                }            }        }        catch(Exception e)        {            out.println(e);        }    %>    <meta http-equiv="refresh" content="2; URL=Show.html">    </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -