我试图在点击确认链接时删除行,警告是第一次点击删除链接但第二次警报未来...... 值被删除而没有警报
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!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>SRK Pvt Ltd.</title>
</head>
<body>
<form:form method="get" action="">
<%-- <h1>${message}</h1>
Enter Name: <input id="tagsName"> --%>
<a href="<c:url value="/helloWorld" />">Autocomplete</a>
<center>
Dear <strong>${user}</strong>, Welcome to DBA Page. <a
href="<c:url value="/logout" />">Logout</a>
<div style="color: teal; font-size: 30px">SRK Pvt Ltd.</div>
<c:if test="${!empty employeeList}">
<script>
function ConfirmDelete() {
var x = confirm("Are you sure you want to delete?");
if (x)
return true;
else
return false;
}
</script>
<table border="1" bgcolor="black" width="600px">
<tr
style="background-color: teal; color: white; text-align: center;"
height="40px">
<td>First Name</td>
<td>Last Name</td>
<td>Email</td>
<td>Phone</td>
<td>Edit</td>
<td>Delete</td>
</tr>
<c:forEach items="${employeeList}" var="user">
<tr
style="background-color: white; color: black; text-align: center;"
height="30px">
<td><c:out value="${user.firstName}" /></td>
<td><c:out value="${user.lastName}" /></td>
<td><c:out value="${user.email}" /></td>
<td><c:out value="${user.phone}" /></td>
<td><a href="edit?id=${user.id} ">Edit</a></td>
<td><a href="delete?id=${user.id}"
Onclick="return ConfirmDelete();">Delete</a></td>
</tr>
</c:forEach>
</table>
</c:if>
<a href="form">Click Here to add new User</a>
</center>
</form:form>
</body>
</html>
第二次警告框未显示单击删除链接时直接删除的值