18910140161

SpringBoot如何删除选定的SQL记录(Therme leaf,javascript,java,Doma2)-堆栈溢出

顺晟科技

2022-10-19 14:40:25

91

我希望能够删除选定的SQL记录。

如果单击记录旁边的按钮,将弹出一个屏幕,显示“您真的要删除它吗?”

如果单击是,则

单击的按钮旁边的SQL记录将从表中删除。

我真的被困在这里,即使是一点点帮助也会有帮助。

<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>selectToDelete</title>
</head>
<body >
    

    <table border="1">
        <tr>
            <td>name</td>
            <td>id</td>
            <td>price</td>
        </tr>
        <tr>
            th:each="i : ${#numbers.sequence(session.sessionInfo.input,session.sessionInfo.input2)}">

            <td th:text="${session.session2.goodsList[i].G_name}">
            <td th:text="${session.session2.goodsList[i].G_id}">
            <td th:text="${session.session2.goodsList[i].G_price}">


<td > <button type="submit" name="deleteParam" th:value="${i}" onclick="DeleteButton1(this.value)">selectButton</button></td>

        </tr>
    </table>



<script th:inline="javascript">
function DeleteButton1(e) {
        if (confirm("Do you want to Delete?")) {

             window.open('deleteScreen', '_self' );

        }else{
            console.log(e)
        }
    }
</script>

</html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>selectToDelete</title>
</head>
<body >
    

    <table border="1">
        <tr>
            <td>name</td>
            <td>id</td>
            <td>price</td>
        </tr>
        <tr>
            th:each="i : ${#numbers.sequence(session.sessionInfo.input,session.sessionInfo.input2)}">

            <td th:text="${session.session2.goodsList[i].G_name}">
            <td th:text="${session.session2.goodsList[i].G_id}">
            <td th:text="${session.session2.goodsList[i].G_price}">


<td > <button type="submit" name="deleteParam" th:value="${i}" onclick="DeleteButton1(this.value)">selectButton</button></td>

        </tr>
    </table>



<script th:inline="javascript">
function DeleteButton1(e) {
        if (confirm("Do you want to Delete?")) {

             window.open('deleteScreen', '_self' );

        }else{
            console.log(e)
        }
    }
</script>

</html>

存储库↓

<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>selectToDelete</title>
</head>
<body >
    

    <table border="1">
        <tr>
            <td>name</td>
            <td>id</td>
            <td>price</td>
        </tr>
        <tr>
            th:each="i : ${#numbers.sequence(session.sessionInfo.input,session.sessionInfo.input2)}">

            <td th:text="${session.session2.goodsList[i].G_name}">
            <td th:text="${session.session2.goodsList[i].G_id}">
            <td th:text="${session.session2.goodsList[i].G_price}">


<td > <button type="submit" name="deleteParam" th:value="${i}" onclick="DeleteButton1(this.value)">selectButton</button></td>

        </tr>
    </table>



<script th:inline="javascript">
function DeleteButton1(e) {
        if (confirm("Do you want to Delete?")) {

             window.open('deleteScreen', '_self' );

        }else{
            console.log(e)
        }
    }
</script>

</html>

服务↓

<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>selectToDelete</title>
</head>
<body >
    

    <table border="1">
        <tr>
            <td>name</td>
            <td>id</td>
            <td>price</td>
        </tr>
        <tr>
            th:each="i : ${#numbers.sequence(session.sessionInfo.input,session.sessionInfo.input2)}">

            <td th:text="${session.session2.goodsList[i].G_name}">
            <td th:text="${session.session2.goodsList[i].G_id}">
            <td th:text="${session.session2.goodsList[i].G_price}">


<td > <button type="submit" name="deleteParam" th:value="${i}" onclick="DeleteButton1(this.value)">selectButton</button></td>

        </tr>
    </table>



<script th:inline="javascript">
function DeleteButton1(e) {
        if (confirm("Do you want to Delete?")) {

             window.open('deleteScreen', '_self' );

        }else{
            console.log(e)
        }
    }
</script>

</html>

SQL文件↓

<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>selectToDelete</title>
</head>
<body >
    

    <table border="1">
        <tr>
            <td>name</td>
            <td>id</td>
            <td>price</td>
        </tr>
        <tr>
            th:each="i : ${#numbers.sequence(session.sessionInfo.input,session.sessionInfo.input2)}">

            <td th:text="${session.session2.goodsList[i].G_name}">
            <td th:text="${session.session2.goodsList[i].G_id}">
            <td th:text="${session.session2.goodsList[i].G_price}">


<td > <button type="submit" name="deleteParam" th:value="${i}" onclick="DeleteButton1(this.value)">selectButton</button></td>

        </tr>
    </table>



<script th:inline="javascript">
function DeleteButton1(e) {
        if (confirm("Do you want to Delete?")) {

             window.open('deleteScreen', '_self' );

        }else{
            console.log(e)
        }
    }
</script>

</html>

顺晟科技:

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航