为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我显示商品详情页里面是空的??

<%@page import="entity.items"%>
<%@page import="dao.itemsDAO"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>商品详情页</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  <style type="text/css">
       div{
          float:left;
          margin-left: 30px;
          margin-right:30px;
          margin-top: 5px;
          margin-bottom: 5px;
       }
       div dd{
          margin:0px;
          font-size:10pt;
       }
       div dd.dd_name
       {
          color:blue;
       }
       div dd.dd_city
       {
          color:#000;
       }
    </style>
  </head>
  
  <body>
  <h1>商品详情</h1>
  <hr>
              <center>
                  <table height="750" width="60" cellpadding="0" cellspacing="0" border="0" >
                      <tr>
                      <%
                          itemsDAO itemdao = new itemsDAO();
                          items item = itemdao.getitemsById(Integer.parseInt(request.getParameter("id"))); 
                              if(item!=null)
                                  {
                       %>
                      <td width="70%" valign="top">
                          <table>
                              <tr>
                                  <td rowspan="4"><img src="images/<%=item.getPicture() %>"  width="200" height="160" /> </td>
                              </tr>
                              <tr>
                                  <td><B><%=item.getName() %></B></td>
                              </tr>
                              <tr>
                                  <td>地址:<%=item.getCity() %></td>
                              </tr>
                              <tr>
                                  <td>价格:<%=item.getPrice() %></td>
                              </tr>
                          </table>
                      </td>
                          <%
                              }
                           %>
                      </tr>
                  </table>
              </center>
  </body>
</html>


正在回答

2 回答

请问我也是取不到值,怎么回事,能否告知一下。

0 回复 有任何疑惑可以回复我~

items item = itemdao.getitemsById(Integer.parseInt(request.getParameter("id"))); 

确定id的值是存在request里了吗

最好贴一下其他代码

0 回复 有任何疑惑可以回复我~
#1

奋斗的小牧童 提问者

这个找到了,是itemsDAO里的返回值多写了个return NULL
2015-05-02 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么我显示商品详情页里面是空的??

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号