clientMange

addClient

<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>添加客户信息</title>
    </head>
    <body background="../image/4.jpg">
        <form action="http://localhost:8080/EIMS/clientManage/addClientCheck.jsp" method="post">
            <table align="center"width="500" >
                <tr>
                    <td><a href="http://localhost:8080/EIMS/clientManage/lookClient.jsp">客户查询</a></td>
                    <td>客户添加</td>
                    <td><a href="http://localhost:8080/EIMS/clientManage/updateClient.jsp">客户修改</a></td>
                    <td><a href="http://localhost:8080/EIMS/clientManage/deleteClient.jsp">客户删除</a></td>
                </tr>
            </table>
            <br>
            <hr>
            <br>
            <table align="center"width="300" >
                 <tr>
                     <th colspan="4" align="center">添加客户信息</th>
                 </tr>
                 <tr>
                     <td>姓名</td>
                     <td><input type="text" name="clientName"/></td>
                 </tr>
                 <tr>
                     <td>电话</td>
                     <td><input type="text" name="clientTelephone"/></td>
                 </tr>
                 <tr>
                     <td>地址</td>
                     <td><input type="text" name="clientAddress"/></td>
                 </tr>
                 <tr>
                     <td>邮箱</td>
                     <td><input type="text" name="clientEmail"/></td>
                </tr>
                <tr align="center">
                     <td colspan="2">
                         <input name="sure"type="submit"value="确认">
                         &nbsp; &nbsp; &nbsp; &nbsp;
                         <input name="clear"type="reset"value="取消">
                     </td>
                </tr>
            </table>
        </form>
    </body>
</html>

addClientCheck

<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>处理客户添加数据</title>
    </head>
    <body>
        <%
            String clientName=new String(request.getParameter("clientName").getBytes("ISO-8859-1"),"gbk");
            String clientTelephone=new String(request.getParameter("clientTelephone").getBytes("ISO-8859-1"),"gbk");
            String clientAddress=new String(request.getParameter("clientAddress").getBytes("ISO-8859-1"),"gbk");
            String clientEmail=new String(request.getParameter("clientEmail").getBytes("ISO-8859-1"),"gbk");
            Connection con=null;
            Statement st=null;
           try{
               Class.forName("com.mysql.jdbc.Driver");
               String url="jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=gbk";
               con=DriverManager.getConnection(url,"root","21328");
               st=con.createStatement();
               String sql="insert into client(clientName,clientTelephone,clientAddress,clientEmail) values ('"+clientName+"','"+clientTelephone+"','"+clientAddress+"','"+clientEmail+"')";
               st.executeUpdate(sql);
               response.sendRedirect("http://localhost:8080/EIMS/clientManage/lookClient.jsp");    
           }
           catch(Exception e){
               e.printStackTrace();
           }
           finally{
              st.close();
              con.close();
           }
        %>
    </body>
</html>

deleteClient

<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>客户删除</title>
    </head>
    <body background="../image/4.jpg">
        <form action="http://localhost:8080/EIMS/clientManage/deleteClientCheck.jsp" method="post">
            <table align="center"width="500" >
                <tr>
                    <td><a href="http://localhost:8080/EIMS/clientManage/lookClient.jsp">客户查询</a></td>
                    <td><a href="http://localhost:8080/EIMS/clientManage/addClient.jsp">客户添加</td>
                    <td><a href="http://localhost:8080/EIMS/clientManage/updateClient.jsp">客户修改</a></td>
                    <td>客户删除</td>
                </tr>
            </table>
            <br>
            <hr>
            <br>
            <table align="center">
                <tr>
                    <th colspan="2">删除客户信息</th>
                </tr>
                <tr>
                    <td>客户姓名</td>
                    <td><input type="text" name="clientName"/>输入要删除的客户姓名</td>
                </tr>
                <tr align="center">
                     <td colspan="2">
                        <input type="submit" name="sure" value="确认"/>
                        &nbsp; &nbsp; &nbsp; &nbsp;
                        <input name="clear"type="reset"value="取消"/>
                     </td>
                </tr>
             </table>
        </form>
    </body>
</html>

deleteClientCheck

<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>处理客户删除数据</title>
    </head>
    <body>
        <%
            String clientName=new String(request.getParameter("clientName").getBytes("ISO-8859-1"),"gbk");
            Connection con=null;
            Statement st=null;
            try{
                 Class.forName("com.mysql.jdbc.Driver");
                 String url="jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=gbk";
                 con=DriverManager.getConnection(url,"root","21328");
                 st=con.createStatement();
                 String sql="delete from client where clientName='"+clientName+"'";
                 st.executeUpdate(sql);
                 response.sendRedirect("http://localhost:8080/EIMS/clientManage/lookClient.jsp");
                 
              }
              catch (Exception e){
                e.printStackTrace();
             }
            finally{
                st.close();
                con.close();
            }
        %>
    </body>
</html>

lookClient

<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>客户查询</title>
    </head>
    <body background="../image/4.jpg">
        <table align="center"width="500">
            <tr>
                <td>客户查询</td>
                <td><a href="http://localhost:8080/EIMS/clientManage/addClient.jsp">客户添加</a></td>
                <td><a href="http://localhost:8080/EIMS/clientManage/updateClient.jsp">客户修改</a></td>
                <td><a href="http://localhost:8080/EIMS/clientManage/deleteClient.jsp">客户删除</a></td>
             </tr>
        </table>
        <br>
        <hr>
        <br>
         <table align="center"width="700"border=2" >
            <tr>
                <th colspan="4">查看客户信息</th>
            </tr>
            <tr>
                <td>姓名</td>
                <td>电话</td>
                <td>地址</td>
                <td>邮箱 </td>    
            </tr>
            <%
                Connection con=null;
                Statement stmt=null;
                ResultSet rs=null;
                Class.forName("com.mysql.jdbc.Driver");
                /*url后面加的?useUnicode=true&characterEncoding=gbk,是为了处理向数据库中添加数据时出现乱码的问题。*/
                String url="jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=gbk";
                con=DriverManager.getConnection(url,"root","21328");
                stmt=con.createStatement();
                String sql="select * from client";
                rs=stmt.executeQuery(sql);
                while(rs.next()){
            %>                         
           <tr>
               <td><%=rs.getString("clientName")%></td>
               <td><%=rs.getString("clientTelephone")%></td>
               <td><%=rs.getString("clientAddress")%></td>
               <td><%=rs.getString("clientEmail")%></td>                 
           </tr>
           <%
                }
           %>
        </table>
    </body>
</html>

updateClient

<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>修改客户信息</title>
    </head>
    <body background="../image/4.jpg">
        <form action="http://localhost:8080/EIMS/clientManage/updateClientCheck.jsp" method="post">
            <table align="center"width="500" >
                <tr>
                    <td><a href="http://localhost:8080/EIMS/clientManage/lookClient.jsp">客户查询</a></td>
                    <td><a href="http://localhost:8080/EIMS/clientManage/addClient.jsp">客户添加</td>
                    <td>客户修改</td>
                    <td><a href="http://localhost:8080/EIMS/clientManage/deleteClient.jsp">客户删除</a></td>
                </tr>
            </table>
            <br>
            <hr>
            <br>
            <table align="center"width="300" >
                <tr>
                    <th colspan="2" align="center">修改客户信息</th>
                </tr>
                <tr>
                    <td>姓名</td>
                    <td><input type="text" name="clientName"/></td>
                </tr>
                <tr>
                    <td>电话</td>
                    <td><input type="text" name="clientTelephone"/></td>
                </tr>
                <tr>
                    <td>地址</td>
                    <td><input type="text" name="clientAddress"/></td>
                </tr>
                <tr>
                    <td>邮箱</td>
                    <td><input type="text" name="clientEmail"/></td>
                </tr>
                <tr align="center">
                    <td colspan="2">
                        <input name="sure"type="submit"value="确认">
                        &nbsp; &nbsp; &nbsp; &nbsp;
                        <input name="clear"type="reset"value="取消">
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

updateClientCheck

<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>处理客户修改数据</title>
    </head>
    <body>
         <%
            String clientName=new String(request.getParameter("clientName").getBytes("ISO-8859-1"),"gbk");
            String clientTelephone=new String(request.getParameter("clientTelephone").getBytes("ISO-8859-1"),"gbk");
            String clientAddress=new String(request.getParameter("clientAddress").getBytes("ISO-8859-1"),"gbk");
            String clientEmail=new String(request.getParameter("clientEmail").getBytes("ISO-8859-1"),"gbk");
            Connection con=null;
            Statement st=null;
            if(clientName.equals("")){
                response.sendRedirect("http://localhost:8080/EIMS/clientManage/updateClient.jsp");
            }
            else{
                try{
                    Class.forName("com.mysql.jdbc.Driver");
                    String url="jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=gbk";
                    con=DriverManager.getConnection(url,"root","21328");
                    st=con.createStatement();
                    String sql="update client set clientName='"+clientName+"',clientTelephone='"+clientTelephone+"',clientAddress='"+clientAddress+"',clientEmail='"+clientEmail+"'where clientName='"+clientName+"'";
                    st.executeUpdate(sql);
                    response.sendRedirect("http://localhost:8080/EIMS/clientManage/lookClient.jsp");
                }
                catch (Exception e){
                    e.printStackTrace();
                }
                finally{
                    st.close();
                    con.close();
                }
            }
        %>
    </body>
</html>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值