关于用JSP显示数据库中商品详细信息的问题,急求各位高人指点,不胜感激
我做了个商品浏览页面,第一个页面列表显示数据库里面商品列表信息,然后在每条的缩略图上设置链接到另一个页面,显示该商品的详细信息。连数据库的时候不知道应该怎么办,显示商品详细信息的页面只出了个空表格,没有数据库里的东西。我的代码如下,希望各位指点一下:
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<jsp:useBean id= "databean " scope= "session " class= "com.conndb "/>
<jsp:useBean id= "list " class= "com.WaresList " scope= "session " />
<jsp:useBean id= "pagebean " scope= "session " class= "com.pagebean "/>
<html>
<head>
<title> 商品详细信息 </title>
<style type= "text/css ">
</style>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 "> </head>
<script language= "javascript ">
</script>
<body>
<div align= "center " class= "b9b "> 商品详细信息
<p>
<form action= "shopcart.jsp " method= "post " name= "form1 ">
<%
databean.getConnection();
ResultSet rs;
String sql= "SELECT * FROM wares ";
rs=databean.executeQuery(sql); //执行sql语句,使用了javabean conndb中的executeQuery
%>
<input type=hidden name= "id " value= " <%=list.WaresId%> " >
<table width= "300 " border= "1 " cellspacing= "1 " cellpadding= "1 " bordercolordark= "#6699ff " bordercolorlight= "#FFFFFF ">
<tr>
<th colspan= "2 " scope= "col "> <img src= "image/BigImg/ <%= list.BigImg %> "> </th>
</tr>
<tr>
<th width= "65 " scope= "row "> 商品名称 </th>
<th width= "222 " scope= "row "> <%=list.Name %> </th>
</tr>
<tr>
<th scope= "row "> 所属种类 </th>
<th scope= "row "> <%=list.Sort%> </th>
</tr>
<tr>
<th scope= "row "> 市场价 </th>
<th scope= "row "> <%if(list.MarketPrice!=0) {