zoukankan      html  css  js  c++  java
  • 网页注册信息添加到数据库中 并查看数据库所有信息

    <%@page import="com.bank.shuyinghengxie.service.BankServiceDAO"%>
    <%@ 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>
    <form action="sucessreg.jsp" method="post">
    姓名<input type="text" name="id"><br>
    密码<input type = "password"  name="password"><br>
    <input type ="submit" value= "提交" >
    
    </form>
    
    </body>
    </html>
    <%@page import="com.bank.shuyinghengxie.Impl.BankPeopleImpl"%>
    <%@page import="java.util.List"%>
    <%@page import="java.net.URLDecoder"%>
    <%@page import="com.bank.shuyinghengxie.service.BankServiceDAO"%>
    <%@ 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>
    
    
    
    <%
            String id = request.getParameter("id") ;
    
            String password = request.getParameter("password") ;
    
            id = new String(id.getBytes("ISO-8859-1") , "UTF-8" ) ; //转码
            
            if(id != null && id != "" && password != null && password != "")
            {
                BankServiceDAO c = new BankServiceDAO() ;
    
                c.getAccount( id, password ) ;
                
                out.write("注册成功") ;
            }
            else
            {
                out.write("注册失败") ;
            }
            
    %>
    <%
    BankServiceDAO c = new BankServiceDAO() ;
    
    List<BankPeopleImpl> list = c.showAll() ;
    
    %>
        <table width="800" align="center" border="1px" bordercolor="#FF0000" cellpadding="0px" cellspacing="0">
            <tr align="center">
                <td>姓名</td>
                <td>卡号</td>
                <td>余额</td>
                <td>密码</td>
            </tr>
            <% 
            for(BankPeopleImpl b: list)
            {
                
                String a = b.getName() ;
                String f = b.getCardID() ;
                double d = b.getBalance() ;
                String e = b.getPassword() ;
                %>
                <tr align="center">
                <td><%out.print(a); %></td>
                <td><%out.print(f) ;%></td>
                <td><%out.print(d) ; %></td>
                <td><%out.print(e) ; %></td>
            </tr>
                <%
            }
            %>
        </table>
    
    
    
    </body>
    </html>

  • 相关阅读:
    params可变参数
    using释放资源
    第二章:深入C#数据类型
    体检套餐项目解析
    堆栈
    C#必看:《第17章节QQ管理系统》
    C#必看:《第15章节学生管理系统》
    ACM hdu 1008 Elavator
    jq尺寸和位置总结篇(width scrollTop position offset)
    find children slice
  • 原文地址:https://www.cnblogs.com/20gg-com/p/6013444.html
Copyright © 2011-2022 走看看