<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String contextPath = request.getContextPath();
%>
<html>
<head>
<title>首页</title>
<link href="<%=contextPath%>/static/mycss.css" rel="stylesheet"/>
</head>
<body>
<script type="text/javascript">
function myjs(){
alert("bbb");
allcheck = document.getElementsByName("box");
alert("ccc");
if (allcheck != null){
alert("ddd");
check_val = []
for(k in allcheck ){
alert("eee");
if(allcheck[k].checked){
check_val.push(allcheck[k].value)
alert("aaaa");
}
}
$.ajax({
url:'${pageContext.request.contextPath }/update.do',
data:{ids:check_val},
dataType:'json',
type:'POST',
traditional:true,//必须设置
success:function(data){
}
});
}
}
</script>
<jsp:include page="comm/top.jsp"/>
<table width="95%" border="1" cellspacing="0" cellpadding="10" style="margin-left:50px;">
<tr>
<td>ckeck</td>
<td>标题</td>
<td>id</td>
<td>内容</td>
<td>操作</td>
</tr>
<c:forEach var="article" items="${articles}" begin="0" step="1">
<tr>
<td style="text-align:center"><input type="checkbox" name="box" value="${article.id}" ></td>
<td>${article.title}</td>
<td>${article.id}</td>
<td>${article.summary}</td>
<!-- <a type="button" href="${path}/user/delUser?id=${user.id}
<input type="button" vlaue="更新" id="">
-->
</tr>
</c:forEach>
</table>
<a type="button" οnclick="myjs()">删除</a>
</body>
</html>
@RequestMapping("/update")
public void update(HttpServletRequest re , HttpServletResponse rew ){
int a=0;
String[] ids = re.getParameterValues("ids");
if(ids!=null && ids.length >0) {
for (String id :ids) {
System.out.println(id);
}
}
}
}