1.jsp页面
<script type="text/javascript">
function delProductByPid(pid){
if(confirm("您是否要删除该项?")){
location.href = "${pageContext.request.contextPath }/product?method=delProductByPidServlet&pid="+pid;
}
}
</script>
----------------------------------
<td>
<a href="javascript:;" οnclick="delProductByPid('${entry.value.product.pid }')" class="delete">删除</a>
</td>
2 servlet代码实现
//通过pid删除该商品项
public void delProductByPidServlet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//接收参数
String pid = request.getParameter("pid");<