数据库中删除记录时的传值问题
JSP中连接数据库又出现了问题,向大家请教
(deletepro.jsp):
id 类别 名称 出厂商 价格 描述 删除 (表格字段)
dddd english ddddd dddddd 22.0 ddddd 删除 (表格内容)
isbn-4-6 computer J2EE企业级应用开发 电子工业出版 56.0 还不错 删除 (表格内容)
现在是想点表格内容中的 "删除 "就可以转向 "deletepro_do.jsp "实现删除其一行
比如点第一个表格内容中的删除,则删除id= "dddd "的一行, "id "是主键
deletepro.jsp主要代码:
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<jsp:useBean id= "db " scope= "page " class= "demo.openDB " />
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 删除商品 </title>
<style type= "text/css ">
<!--
.STYLE2 {color: #FFFFFF}
-->
</style>
</head>
<body>
<br/> <br/> <br/>
<center>
<font size= "+5 " face= "华文隶书 "> 删除一个商品 </font>
</center>
<br/> <br/> <br/> <br/>
<center>
<table bgcolor= "#FF6666 ">
<tr>
<td width= "100 "> id </td>
<td width= "100 " align= "center "> 类别 </td>
<td width= "200 " align= "center "> 名称 </td>
<td width= "150 " align= "center "> 出厂商 </td>
<td width= "100 " align= "center "> 价格 </td>
<td width= "150 " align= "center "> 描述 </td>
<td width= "50 " align= "center "> 删除 </td>
</tr>
<%
Connection conn=db.getConnection();
String sql= "select * from products ";
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<tr>
<td bgcolor= "#FFDD33 "> <%=rs.getString( "productid ")%> </td>
<td bgcolor= "#FFFF00 "> <%=rs.getString( "category ")%> </td>
<td bgcolor= "#99CC00 "> <%=rs.getString( "name ")%> </td>
<td bgcolor= "#FFCC99 "> <%=rs.getString( "producer ")%> </td>
<