如何使用AJAX jquery和mongodb动态添加编辑删除行?

时间:2017-08-19 08:29:18

标签: ajax mongodb html-table

我是业余爱好者,我不知道如何使用ajax和MongoDB编辑和删除列表表。你能帮我写一下吗? IN JSP:

<form method="post" action="PkgPanelServlet">
        <!--<form method="post" action="AddPack">-->
        <input type="text" name="codename" value="" placeholder="code"/><br>
       <input type="submit" name="save_pkg" value="save" />
    </form>
    <c:forEach items="${requestScope.messages}" var="messages">
        <table border="1">
            <tr>
                <td><c:out value="${messages._id}"></c:out></td>
                </tr><tr>
                    <td><c:out value="${messages.pkg_code}"></c:out></td>
                </tr><tr>
                    <td>
                        <!--<a href='<c:out value="${editURL}" escapeXml="true"></c:out>'>Edit</a>-->
                        <form method="post" action="db.jsp">
                            <!--<div class="form-group col-sm-3 col-lg-3">-->
                            <button id="update" type="submit" >Update</button>
                            <button id="delete" type="submit" >Delete</button>
                            <input id="secret2" name="secret2" value="abc" type="hidden">
                            <!--</div>-->
                        </form>
                    </td>
                </tr><tr>
                    <td>
                        <a href="javascript:confirmGo('Sure to delete this record?','deleteActionPack.jsp?id=<c:out value="${messages._id}"/>')">Delete</a>
                </td>
            </tr>
        </table>
    </c:forEach>

在Servlet中:

request.setAttribute("messages", documents);
        request.getRequestDispatcher("PackagesPanel.jsp").forward(request, response);

0 个答案:

没有答案