JSP的商品详细信息问题``急的尿裤子了``郁闷``
各位前辈``我想做一个商品的详细信息页面`点击商品详细信息`自动弹出对应的详细信息!
这个是商品的页面小部分代码: <a href= "hwmsg.jsp?item= <%= id[i] %> " target= "_blank "> [详细] </a> </a> </font> </h4> </td>
点这个详细后然后连接hwmsg.jsp``可是页面始终是空白并抛出一个catch里的 "catch1 "异常!!
这里是hwmsg.jsp的全部代码:
<html>
<body>
<table width= "100% " border= "0 " align= "center " cellpadding= "0 " cellspacing= "1 " style= "margin-bottom: 6 ">
<tr bgcolor= "#FFFFFF ">
<td height= "100 " colspan= "2 " align= "center ">
<div align= "center "> </div>
<table width= "95% " height= "5 " border= "0 " align= "center " cellpadding= "0 " cellspacing= "0 ">
<%
Connection dbcon=null;
String id=request.getParameter( "item "); //图书编号
String author; //作者
String name; //书名
float price; //书价
String discrip; //简介
float hprice; //会员jia
String picture; //图片地址
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
dbcon=DriverManager.getConnection( "jdbc:odbc:book ", " ", " ");
System.out.println( "Connection established ");
}
catch(ClassNotFoundException e)
{
System.out.println( "Database driver not found ");
System.out.println(e.toString());
}
catch (Exception e)
{
System.out.println(e.toString());
}
try
{
PreparedStatement s=dbcon.prepareStatement( "select productid,author,name,price,,message,picture from taoqi_product where productid= ' "+id+ " ' ");
ResultSet result=s.executeQuery();
result.next();
author = result.getString( "author ");
name = result.getString( "name ");
price = result.getFloat( "price ");
discrip= result.getString( "message ");
picture= result.getString( "picture ");
%>
<tr>
<td width= "100% " valign= "top ">
<table width= "100% " border= "0 " cellspacing= "0 " cellpadding= "0 " height= "10 ">
<tr>
<td> </td>
</tr>
</table>
<table border= "0 " width= "100% " cellspacing= "0 ">
<tr>
<td width= "100% " bgcolor= "#FFFFFF " valign= "top ">
<table width= "100% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td width= "180 " style= "border-right:#DBC2B0 1px solid ">
<div align= "center "> <a href= " <%= picture %> " target= "_blank ">
<img border= "0 " src= " <%= picture %> " width= "140 " height= "99 "> <br>
</div>
</td>
<td width= "362 " align= "center "> <font color= "#D06800 "> <b class= "dz1 "> </b> </font> </a>
<div align= "center ">
<center>
<table width= "90% " border= "1 " cellpadding= "0 " cellspacing= "0 " style= "border-collapse: collapse " bordercolor= "#808080 " bgcolor= "#F5EFE7 ">
<tr align= "center ">
<td height= "25 " colspan= "2 "> 商品名称: <%= name %> </a> </td>
</tr>
<tr bgcolor= "#FFFFFF ">
<td width= "50% " height= "25 ">
<div align= "right "> 商品号: </div>
</td>
<td width= "50% " height= "25 ">
<div align= "center "> <s> </s> </div>
</td>
</tr>
<tr bgcolor= "#FFFFFF ">
<td height= "25 ">
<div align= "right "> 作者: </div>
</td>
<td height= "25 ">
<div align= "center "> <font color= "#D03430 "> <%= author %> </font> </div>
</td>
</tr>
<tr bgcolor= "#FFFFFF ">
<td height= "25 ">
<div align= "right "> <font size= "1 " face= "sans-serif "> </font> 价格: </div>
</td>
<td height= "25 ">
<div align= "center "> <font color= "#D03430 "> ¥ <%= price %> </font> 元 </div>
</td>
</tr>
<tr bgcolor= "#FFFFFF ">
<td height= "35 " colspan= "2 ">
</td>
</tr>
</table>
</center>
</div>
<table width= "95% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td height= "30 " valign= "bottom "> </td>
</tr>
</table>
<table width= "95% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td>
</td>
</tr>
</table>
<table width= "95% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td height= "5 "> <img src= "img/pics/seperator.gif " width= "359 " height= "1 "> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width= "100% " bgcolor= "#FFFFFF " valign= "top " align= "center ">
<table width= "100% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td bgcolor= "f7f7f7 " style= "border-bottom:#cccccc 1px solid "> 商 品 详 细 说 明 </td>
</tr>
<tr>
<td style= "line-height:20px "> <%=discrip%> </td>
</tr>
</table>
</table>
<td width= "100% "> </td>
</tr>
</table>
<table width= "95% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td> </td>
</tr>
</table>
<table width= "95% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
</table>
<br>
<table width= "100% " height= "25 " border= "0 " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td valign= "middle ">
<div align= "center "> <img src= "img/pics/seperator.gif " width= "359 " height= "1 "> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
}
catch (SQLException e)
{
System.out.println( "catch 1 ");
}
%>
</body>
</html>
实在是解决不了了``````哪位前辈帮我修改下啊```狂给分啊``555
[解决办法]
catch(ClassNotFoundException e)
{
System.out.println( "Database driver not found ");
System.out.println(e.toString());
}
catch (Exception e)
{
System.out.println(e.toString());
}
怎么有两个catch啊
[解决办法]
System.out.println( "catch 1 ");
改成 System.out.println(e);
看看出错提示是什么,然后在根据提示改!
[解决办法]
oh my god ,好长啊,看的累
[解决办法]
代码很乱
那几个try catch是ide生成的吧