在观看黑马视频教程里面,在java script里使用:
Location.href="${pageContext.request.contextPath}/deleteServlet?id="+id;
设置URL来切换到删除表单某项的servlet代码段,但是不能设置URL成功。修改为:
window.location = "${pageContext.request.contextPath}/deleteServlet?id="+id;
或
location = "${pageContext.request.contextPath}/deleteServlet?id="+id;
就成功了!