首页 > 其他分享 >简单的增删改查

简单的增删改查

时间:2023-02-26 11:02:17浏览次数:37  
标签:preparedStatement String 改查 shijian jsp 简单 增删 close public

这个增删改查困扰了很长时间,没学过相关内容的是真的不会。

这是用idea写的内容。

 

这是文件名

 

 

 

项目结构需要的jar包

 

 

数据库

 

 

 

 

 

 

 Data.java

package test;

import java.sql.*;

public class Data {
    public String shijian, guanjianzi, zongjie, tiansshu, shichang;

    public String getTime() {
        return shijian;
    }

    public void setTime(String time) {
        this.shijian = time;
    }

    public String getGuanjianzi() {
        return guanjianzi;
    }

    public void setGuanjianzi(String guanjianzi) {
        this.guanjianzi = guanjianzi;
    }

    public String getZongjie() {
        return zongjie;
    }

    public void setZongjie(String zongjie) {
        this.zongjie = zongjie;
    }

    public String getTiansshu() {
        return tiansshu;
    }

    public void setTiansshu(String tiansshu) {
        this.tiansshu = tiansshu;
    }

    public String getShichang() {
        return shichang;
    }

    public void setShichang(String shichang) {
        this.shichang = shichang;
    }


    public Connection getConnection()//连接数据库
    {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            //System.out.println("加载驱动成功");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        String user = "root";
        String password = "zhoujiaqi123";
        String url = "jdbc:mysql://localhost:3306/db3?useSSL=false&serverTimezone=GMT&characterEncoding=utf-8&autoReconnect=true";
        Connection con = null;
        try {
            con = DriverManager.getConnection(url, user, password);
            //System.out.println("数据库连接成功");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return con;
    }

    //**********************************************************************
    //关闭方法
    public void close(Connection con) {
        try {
            if (con != null) {
                con.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public void close(PreparedStatement preparedStatement) {
        try {
            if (preparedStatement != null) {
                preparedStatement.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public void close(ResultSet resultSet) {
        try {
            if (resultSet != null) {
                resultSet.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
//增
    public void adddata(String shijian, String guanjianzi, String zongjie, String tianshu, String shichang) {
        Connection connection = getConnection();
        PreparedStatement preparedStatement = null;
        try {
            String sql = "insert into test (shijian ,guanjianzi ,zongjie , tianshu ,shichang ) values (?,?,?,?,?)";
            preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1, shijian);
            preparedStatement.setString(2, guanjianzi);
            preparedStatement.setString(3, zongjie);
            preparedStatement.setString(4, tianshu);
            preparedStatement.setString(5, shichang);
            preparedStatement.executeUpdate();
            System.out.println("添加成功");

        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            close(preparedStatement);
            close(connection);
        }

    }

//删
    public void deletedata(String shijian) {
        Connection connection = getConnection();
        PreparedStatement preparedStatement = null;
        try {
            String sql = "delete from test where shijian = ?";
            preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1, shijian);
            preparedStatement.executeUpdate();
            //System.out.println("删除成功");

        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            close(preparedStatement);
            close(connection);
        }
    }

    //改
    public void revisedata(String shijian, String guanjianzi, String zongjie, String tianshu, String shichang) {
        Connection connection = getConnection();
        PreparedStatement preparedStatement = null;
        try {
            String sql = "update test set guanjianzi=?, zongjie=?, tianshu=?, shichang=? where shijian=?";
            preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1, guanjianzi);
            preparedStatement.setString(2, zongjie);
            preparedStatement.setString(3, tianshu);
            preparedStatement.setString(4, shichang);
            preparedStatement.setString(5, shijian);
            preparedStatement.executeUpdate();

        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            close(preparedStatement);
            close(connection);
        }

    }


    //判重/判存在
    public boolean isSame(String s1) {
        Connection connection = getConnection();
        PreparedStatement preparedStatement = null;
        ResultSet rs = null;
        try {
            String sql = "select * from test";
            preparedStatement = connection.prepareStatement(sql);
            rs = preparedStatement.executeQuery();
            while (rs.next()) {
                if (s1.equals(rs.getObject(1)) || s1.equals(rs.getObject(2)))
                    return true;
            }
            preparedStatement.executeUpdate();

        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            close(rs);
            close(preparedStatement);
            close(connection);
        }
        return false;
    }
}

menu.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>主菜单</title>
</head>
<form action="addInput.jsp" method="get">
    <p style="text-align:center;color:white;font-family:宋体; font-size:20px">
        增删改查

        <br> 选择功能: <input type="button" value="信息登记" onclick="location.href='fabu.jsp'" />
        <input type="button" value="信息删除" onclick="location.href='shanchu.jsp'" />
        <input type="button" value="信息修改" onclick="location.href='xiugai.jsp'" />
        <input type="button" value="查询信息" onclick="location.href='search.jsp'" />
        <input type="button" value="浏览信息" onclick="location.href='show.jsp'" />
        <br>
    </p>

</form>
</body>

</html>

 

fabu.jsp

<%@page import="test.Data"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>登记</title>
</head>
<body>
<form action="fabujudge.jsp" method="get">
  <p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <br>
    <br>日期 <input type="text" name="shijian" size="20" />
    <br>每日关键字 <input type="text" name="guanjianzi" size="15"  >
    <br>每日总结<input type="text" name="zongjie" size="15"  >
    <br>坚持天数 <input type="text" name="tianshu" size="10"  ><br>
    <br>连续最高时长 <input type="text" name="shichang" size="20"  >
    <br><input type="submit" value="提交" />
    <input type="reset" value="重置" />  <br>
    <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
  </p>
  </p>
</form>
</body>
</html>

fabujudge.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<jsp:useBean id="test" class="test.Data" scope="page" />
<%
    String shijian=(String)request.getParameter("shijian");
    String guanjianzi=(String)request.getParameter("guanjianzi");
    String zongjie=(String)request.getParameter("zongjie");
    String tianshu=(String)request.getParameter("tianshu");
    String shichang=(String)request.getParameter("shichang");
        test.adddata(shijian, guanjianzi, zongjie, tianshu, shichang);
        out.print("<script language='javaScript'> alert('添加成功');</script>");
        response.setHeader("refresh", "0;url=show.jsp");


%>
</body>
</html>

shanchu.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>删除</title>
</head>
<body>
<form action="shanchujudge.jsp" method="get">
    <p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
        删除
        <br> 要删除时间为: <input type="text" name="shijian" /> <br>
        <br><input type="submit" value="确定" />
        <input type="reset" value="重置" />  <br>
        <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
    </p>
</form>
</body>
</html>

shanchujudge.jsp

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<jsp:useBean id="test" class="test.Data" scope="page" />
<%
    String shijian=(String)request.getParameter("shijian");
    if(shijian==""){
        out.print("<script language='javaScript'> alert('输入为空'); window.history.back(-1); </script>");
    }
    else if(!test.isSame(shijian))
    {
        out.print("<script language='javaScript'> alert('该活动主题不存在'); window.history.back(-1); </script>");
    }
    else {
%>
<table border="1"style="text-align:center;">
    <tr>
        <td align="center" width=10%>日期</td>
        <td align="center" width=10%>每日关键字</td>
        <td align="center" width=10%>每日总结</td>
        <td align="center" width=10%>坚持天数</td>
        <td align="center" width=10%>连续最高时长</td>
    </tr>
    <%
        Connection connection = test.getConnection();
        PreparedStatement preparedStatement=null;
        ResultSet rs=null;
        try {
            String sql = "select * from test";
            preparedStatement=connection.prepareStatement(sql);
            rs=preparedStatement.executeQuery();
            while(rs.next()){
                if(shijian.equals(rs.getObject(1)))
                {
    %>
    <tr>
        <td align="center"><%=rs.getObject(1) %></td>
        <td align="center"><%=rs.getObject(2) %></td>
        <td align="center"><%=rs.getObject(3) %></td>
        <td align="center"><%=rs.getObject(4) %></td>
        <td align="center"><%=rs.getObject(5) %></td>
        <td align="center"><a style="color:blue" href='shanchujudge2.jsp?shijian=<%=rs.getObject(1) %>' onclick="javascript:return del()">删除</a> </td>
    </tr>

    <%
                }
            }
        } catch (SQLException  e) {
            e.printStackTrace();
        }finally{
            test.close(rs);
            test.close(preparedStatement);
            test.close(connection);
        }
    %>
</table>
<%
    }
%>

<script>
    function del(){
        var r = confirm("确定要删除吗?")
        if (r == true) {
            return true;
        } else {
            return false;
        }
    }
</script>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

shanchujudge2.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page import="test.Data"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<input type="button" onclick="openResult()" value="删除"/>
<jsp:useBean id="test" class="test.Data" scope="page" />
<%
    String shijian=(String)request.getParameter("shijian");
    test.deletedata(shijian);
    out.print("<script language='javaScript'> alert('删除成功');</script>");
    response.setHeader("refresh", "0;url=shanchu.jsp");
%>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

xiugai.jsp

<%@page import="test.Data"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改</title>
</head>
<body>
<form action="xiugaijudge.jsp" method="get">
    <p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
        <br> 输入要修改的日期 <input type="text" name="shijian" /><br>
        <br><input type="submit" value="提交" />
        <input type="reset" value="重置" />  <br>
        <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
    </p>
</form>
</body>
</html>

xiugaijudge.jsp

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登记</title>
</head>
<body>

<jsp:useBean id="test" class="test.Data" scope="page" />
<%
    String shijian=(String)request.getParameter("shijian");
    if(shijian==""){
        out.print("<script language='javaScript'> alert('输入为空'); window.history.back(-1); </script>");
    }
    else if(!test.isSame(shijian))
    {
        out.print("<script language='javaScript'> alert('该住户不存在'); window.history.back(-1); </script>");
    }
    else{
%>
<table border="1"style="text-align:center;">
    <tr>
        <td align="center" width=10%>日期</td>
        <td align="center" width=10%>每日关键字</td>
        <td align="center" width=10%>每日总结</td>
        <td align="center" width=10%>坚持天数</td>
        <td align="center" width=10%>连续最高时长</td>
    </tr>
    <%
        Connection connection = test.getConnection();
        PreparedStatement preparedStatement=null;
        ResultSet rs=null;
        try {
            String sql = "select * from test";
            preparedStatement=connection.prepareStatement(sql);
            rs=preparedStatement.executeQuery();
            while(rs.next()){
                if(shijian.equals(rs.getObject(1)))
                {
    %>
    <tr>
        <td align="center"><%=rs.getObject(1) %></td>
        <td align="center"><%=rs.getObject(2) %></td>
        <td align="center"><%=rs.getObject(3) %></td>
        <td align="center"><%=rs.getObject(4) %></td>
        <td align="center"><%=rs.getObject(5) %></td>
        <td align="center"><a style="color:blue" href='xiugaijudge2.jsp?shijian=<%=rs.getObject(1) %>'>修改</a> </td>
    </tr>
    <%
                }
            }
        } catch (SQLException  e) {
            e.printStackTrace();
        }finally{
            test.close(rs);
            test.close(preparedStatement);
            test.close(connection);
        }
    %>
</table>
<%
    }
%>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

xiugaijudge2.jsp

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<jsp:useBean id="test" class="test.Data" scope="page" />
<%
    String shijian=(String)request.getParameter("shijian");
    session.setAttribute("shijian",shijian);
%>
<table border="1"style="text-align:center;">
    <tr>
        <td align="center" width=10%>日期</td>
        <td align="center" width=10%>每日关键字</td>
        <td align="center" width=10%>每日总结</td>
        <td align="center" width=10%>坚持天数</td>
        <td align="center" width=10%>连续最高时长</td>
    </tr>
    <%
        Connection connection = test.getConnection();
        PreparedStatement preparedStatement=null;
        ResultSet rs=null;
        try {
            String sql = "select * from test";
            preparedStatement=connection.prepareStatement(sql);
            rs=preparedStatement.executeQuery();
            while(rs.next()){
                if(shijian.equals(rs.getObject(1)))
                {
    %>
    <tr>
        <td align="center"><%=rs.getObject(1) %></td>
        <td align="center"><%=rs.getObject(2) %></td>
        <td align="center"><%=rs.getObject(3) %></td>
        <td align="center"><%=rs.getObject(4) %></td>
        <td align="center"><%=rs.getObject(5) %></td>
    </tr>
    <%
                }
            }
        } catch (SQLException  e) {
            e.printStackTrace();
        }finally{
            test.close(rs);
            test.close(preparedStatement);
            test.close(connection);
        }
    %>
</table>

<form action="xiugaijudge3.jsp" method="get">
    <p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
        <br>
        <br>
        修改信息
        <br>每日关键字 <input type="test" name="guanjianzi"  /><br>
        <br> 每日总结 <input type="text" name="zongjie" /><br>
        <br> 坚持天数 <input type="text" name="tianshu" /><br>
        <br> 连续最高时长 <input type="text" name="shichang" /><br>
        <br>
        <br><input type="submit" value="提交" />
        <input type="reset" value="重置" />  <br>
        <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
    </p>
</form>
</body>
</html>

xiugaijudge3.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<jsp:useBean id="test" class="test.Data" scope="page" />
<%
    String shijian=(String)session.getAttribute("shijian");
    String guanjianzi=(String)request.getParameter("guanjianzi");
    String zongjie=(String)request.getParameter("zongjie");
    String tianshu=(String)request.getParameter("tianshu");
    String shichang=(String)request.getParameter("shichang");
    if(guanjianzi==""||zongjie==""||tianshu==""||shichang=="")
    {
        out.print("<script language='javaScript'> alert('输入为空');window.history.back(-1);</script>");
    }
    else
    {
        test.revisedata(shijian,guanjianzi, zongjie, tianshu, shichang);
        out.print("<script language='javaScript'> alert('修改成功');</script>");
        response.setHeader("refresh", "0;url=show.jsp");
    }
%>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

search.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>查询</title>
</head>
<body>
<form action="searchjudge.jsp" method="get">
    <p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
        输入要查询信息的时间/关键字(支持模糊查询):
        <br> <input type="text" name="data" /> <br>
        <br><input type="submit" value="提交" />
        <input type="reset" value="重置" />  <br>
        <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
    </p>
</form>
</body>
</html>

searchjudge.jsp

<%@ page language="java" import="java.sql.*"  contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>查询</title>
</head>
<body style="text-align:center">
查询结果
<p>
    <jsp:useBean id="test" class="test.Data" scope="page" />
        <%
String data=(String)request.getParameter("data");
if(data==""){
    out.print("<script language='javaScript'> alert('输入为空'); window.history.back(-1); </script>");
}
else
{
    %>
<table border="1"style="text-align:center;">
    <tr>
        <td align="center" width=6%>时间</td>
        <td align="center" width=3%>每日关键字</td>
        <td align="center" width=10>每日总结</td>
        <td align="center" width=10%>坚持天数</td>
    </tr>
    <%
        int i=0;
        Connection connection = test.getConnection();
        PreparedStatement preparedStatement=null;
        ResultSet rs=null;
        try {
            String sql= " select * from test where shijian like ? or guanjianzi like ?  ";
            preparedStatement=connection.prepareStatement(sql);
            preparedStatement.setString(1,"%"+data+"%");
            preparedStatement.setString(2,"%"+data+"%");
            rs=preparedStatement.executeQuery();
            while(rs.next())
            {
                i++;
    %>
    <tr>
        <td align="center"><a style="color:blue" href='searchshowall.jsp?shijian=<%=rs.getObject(1) %>'><%=rs.getObject(1) %></a> </td>
        <td align="center"><%=rs.getObject(2) %></td>
        <td align="center"><%=rs.getObject(3) %></td>
        <td align="center"><%=rs.getObject(4) %></td>
    </tr>
    <%
                }
                if(i==0)
                {
                    out.print("<script language='javaScript'> alert('没有查询到有关信息'); window.history.back(-1); </script>");
                }
            } catch (SQLException  e) {
                e.printStackTrace();
            }finally{
                test.close(rs);
                test.close(preparedStatement);
                test.close(connection);
            }
        }
    %>
</table>

<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <br> <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

searchshowall.jsp

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>详细信息</title>
</head>
<body>


<jsp:useBean id="test" class="test.Data" scope="page" />

<%
    String shijian = (String)request.getParameter("shijian");
    Connection connection = test.getConnection();
    PreparedStatement preparedStatement=null;
    ResultSet rs=null;
    try {
        String sql = "select * from test";
        preparedStatement=connection.prepareStatement(sql);
        rs=preparedStatement.executeQuery();
        while(rs.next()){
            if(shijian.equals(rs.getObject(1)))
            {
%>
<table border="1"style="text-align:center;">
    <tr>
        <td align="center" width=10%>日期</td>
        <td align="center" width=10%>每日关键字</td>
        <td align="center" width=10%>每日总结</td>
        <td align="center" width=10%>坚持天数</td>
        <td align="center" width=10%>连续最高时长</td>
    </tr>
    <tr>
        <td align="center"><%=rs.getObject(1) %></td>
        <td align="center"><%=rs.getObject(2) %></td>
        <td align="center"><%=rs.getObject(3) %></td>
        <td align="center"><%=rs.getObject(4) %></td>
        <td align="center"><%=rs.getObject(5) %></td>
    </tr>
    <%
                }
            }
        } catch (SQLException  e) {
            e.printStackTrace();
        }finally{
            test.close(rs);
            test.close(preparedStatement);
            test.close(connection);
        }
    %>
</table>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
    <input type="button" name="back" onclick="javascript:window.history.back(-1);" value=返回上一页>
    <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

show.jsp

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>浏览信息</title>
</head>
<body>


<jsp:useBean id="test" class="test.Data" scope="page" />
<table border="1"style="text-align:center;">
  <tr>
    <td align="center" width=10%>日期</td>
    <td align="center" width=10%>每日关键字</td>
    <td align="center" width=10%>每日总结</td>
    <td align="center" width=10%>坚持天数</td>
    <td align="center" width=10%>连续最高时长</td>
  </tr>
  <%
    Connection connection = test.getConnection();
    PreparedStatement preparedStatement=null;
    ResultSet rs=null;
    try {
      String sql = "select * from test";
      preparedStatement=connection.prepareStatement(sql);
      rs=preparedStatement.executeQuery();
      while(rs.next()){
  %>
  <tr>
    <td align="center"><%=rs.getObject(1) %></td>
    <td align="center"><%=rs.getObject(2) %></td>
    <td align="center"><%=rs.getObject(3) %></td>
    <td align="center"><%=rs.getObject(4) %></td>
    <td align="center"><%=rs.getObject(5) %></td>
  </tr>
  <%
      }
    } catch (SQLException  e) {
      e.printStackTrace();
    }finally{
      test.close(rs);
      test.close(preparedStatement);
      test.close(connection);
    }
  %>
</table>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
  <input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>
</p>
</body>
</html>

以上就是本次增删改查的全部内容

 

 

 

参考:https://www.cnblogs.com/a8047/p/13991772.html

具体问题请看原作者。

标签:preparedStatement,String,改查,shijian,jsp,简单,增删,close,public
From: https://www.cnblogs.com/zjq164/p/17156269.html

相关文章

  • Python学习记录-异常处理函数的简单使用
    有时一些程序即便语法合规,但在执行过程中也会出现错误,比如下面这个例子defspam(divideBy):return10/divideByprint(spam(10))print(spam(20))print(spam(0))p......
  • JAVAWEB学习-实现增删改查-03
    今天继续写之前的没写完的增删改查,完成增和查代码normal1.java1packageTest.test1;23importjavax.servlet.ServletException;4importjavax.servlet......
  • 简单选择排序
    classSelectSort{publicvoidsort(int[]a){for(inti=0;i<a.length-1;i++){//一共进行n-1趟intmin=i;//记录最小元素位置......
  • 【基础算法】简单排序-选择排序
    【基础算法】简单排序-选择排序将待排序数组分成有序部分和无序部分,无序部分初始长度为0,每次遍历有序部分,找到有序部分最小(最大)的数,和无序部分第一个数进行交换,使其变成有......
  • JOI 简单题选做
    就是把洛谷上评分为紫的题做了一下(汗)前两道题没做出来,暴露了自己在dp上的短板。イベント巡り2一开始想到贪心,但发现我们只要选\(k\)个即可,所以可以尝试一些更劣但......
  • 简单熟悉下设计模式
    寻找到底用的什么设计模式目录寻找到底用的什么设计模式11.背景11.1.海超写的es,在枚举里面完成了各个方法的调用.感觉很厉害看下12.先熟悉下23中设计模式1......
  • JavaScript最简单的发布/订阅模式
    以下的是在ES6语法上构建的,非常适用于常见的应用场景//消息通知//发布/订阅模式classYLNotificationMessages{constructor(){//事件对象:存放事件的订阅......
  • Django ORM 多表操作:一对一、一对多、多对多的增删改,基于对象/双下划线的跨表查询 (二
    DjangomodelORM数据表相关操作分析思路,创建数据表对于表操作,表之间的关联关系,必须理解他们之间的关系,对于编程很重要。可以看看映射关系、外键和relationship查询,至少明......
  • “简单的编程方面的喧嚣”是一个谎言
    点击诱饵趋势让我发疯。一些作者承诺容易赚钱。他们说兼职经营企业是一项简单的任务。你是一名程序员,所以你应该能够自动化你的业务,对吧?不要买垃圾。快速致富的计划一直......
  • 1_log4j1和log4j2的简单配置
     项目中添加依赖log4j2<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId><version>2.12.1</version></dependenc......