Web这四句是什么意思? 5
下个图中的都是什么意思?这个是Web的,求一句一句解答<body><%String[]ids=request.getParameterValues("sel");Stri...
下个图中的都是什么意思? 这个是Web的,求一句一句解答
<body>
<%
String[] ids = request.getParameterValues("sel");
String str = "(";
for(String s:ids){
str +=s+",";
}
str = str.substring(0,str.length()-1) + ")";
String sql = "delete from tbgoods where good_id in" + str;
try{
Connection conn = DBUtil.getConn();
PreparedStatement ps = conn.prepareStatement(sql);
int i = ps.executeUpdate();
if(i > 0){
out.println("<script>alert('删除成功');window.location.href='goodsList.jsp'</script>");
}else{
out.println("<script>alert('删除失败');window.location.href='goodsList.jsp'</script>");
}
}catch(Exception e){
e.printStackTrace();
out.println("<script>alert('删除失败');window.location.href='goodsList.jsp'</script>");
}
%>
</body> 展开
<body>
<%
String[] ids = request.getParameterValues("sel");
String str = "(";
for(String s:ids){
str +=s+",";
}
str = str.substring(0,str.length()-1) + ")";
String sql = "delete from tbgoods where good_id in" + str;
try{
Connection conn = DBUtil.getConn();
PreparedStatement ps = conn.prepareStatement(sql);
int i = ps.executeUpdate();
if(i > 0){
out.println("<script>alert('删除成功');window.location.href='goodsList.jsp'</script>");
}else{
out.println("<script>alert('删除失败');window.location.href='goodsList.jsp'</script>");
}
}catch(Exception e){
e.printStackTrace();
out.println("<script>alert('删除失败');window.location.href='goodsList.jsp'</script>");
}
%>
</body> 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)+提问者悬赏5(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询