right.jsp
上传用户:helenhuo66
上传日期:2007-06-01
资源大小:865k
文件大小:8k
源码类别:

百货/超市行业

开发平台:

Java

  1. <!-------------------------right begin------------------------------------->
  2.   <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom: 6">
  3.         <tr bgcolor="#FFFFFF"> 
  4.           <td height="100" colspan="2" align="center" valign="top"> 
  5.             <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom: 6">
  6.               <tr> 
  7.                 <td height="100" colspan="2" bgcolor="#FFFFFF"> 
  8.                   <div align="center"></div>
  9.                   <table width="100%" height="5" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  10.                     <tr> 
  11.                       <td>
  12. <p align="center">
  13. <a target="_blank" href="http://www.jspshop.cn/">
  14. <img src="img/banner.gif" width="100%" height="111" border="0"></a></td>
  15.                     </tr>
  16.                     <tr> 
  17.                       <td width=478 height="2" style="border-bottom:#cccccc 1px solid" bgcolor="f7f7f7"> 
  18.                         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  19.                           <tr> 
  20.                             <td width="8%"> </td>
  21.                               <td height="25" valign="middle">
  22.   <%=sort_name%>
  23.             <%
  24. sql="select * from Nsort where sort_id="+sort_id;
  25. rs=mdb.executeQuery(sql);
  26. while(rs.next())
  27. {
  28. %>
  29. >><a href="nsort.jsp?sort_id=<%=sort_id%>&nsort_id=<%=rs.getInt("nsort_id")%>"><%=rs.getString("Nsort_name")%></a>
  30. <%
  31. }
  32.     rs.next();
  33. %>
  34.   </td>
  35.                           </tr>
  36.                         </table>
  37.                       </td>
  38.                     </tr>
  39.                     <tr> 
  40.                       <td width="100%"> 
  41.                         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  42.                           <tr> 
  43.                             <td valign="top"> 
  44.                               <div align="center"> </div>
  45.                               <table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
  46.                                 <tr> 
  47.                                   <td valign="top"> 
  48.                                     <table width="100%" border="0" cellspacing="0" cellpadding="0" >
  49.  
  50. <%
  51. int PageSize =10; //设置每张网页显示两条记录
  52. int ShowPage = 1; //设置欲显示的页数
  53. int RowCount = 0; //ResultSet的记录数目
  54. int PageCount = 0; //ResultSet分页后的总页数
  55. int duoyu=0;
  56. sql="select * from hw where sort_id="+sort_id+" order by hw_id desc ";
  57. rs=mdb.executeQuery(sql);
  58. if(rs.next())
  59.  {
  60.   //建立ResultSet(结果集)对象,并执行SQL语句
  61.   rs.last(); //将指标移至最后一笔记录
  62.   RowCount=rs.getRow();
  63.   duoyu=RowCount % PageSize;
  64.   if(duoyu==0)
  65.   {
  66.   PageCount=RowCount/PageSize;
  67.   }
  68.   else{
  69.   PageCount=(RowCount-duoyu)/PageSize;
  70.   PageCount++;
  71.   }
  72.  // PageCount=((RowCount % PageSize) == 0?(RowCount/PageSize) : (RowCount/PageSize)+1);
  73.   //计算显示的页数
  74. String ToPage = request.getParameter("ToPage");
  75. if(ToPage==""){ToPage="1";}
  76. //判断是否可正确取得ToPage参数, 
  77. //可取得则表示JSP网页应显示特定分页记录的语句
  78. if(ToPage!=""){
  79.    ShowPage =Cint(ToPage); //取得指定显示的分页页数
  80.    //下面的if语句将判断用户输入的页数是否正确
  81.   if(ShowPage > PageCount)
  82.    { //判断指定页数是否大于总页数, 是则设置显示最后一页
  83.     ShowPage = PageCount;
  84.    }
  85.    else if(ShowPage <= 0)
  86.    { //若指定页数小于0, 则设置显示第一页的记录
  87.      ShowPage = 1;
  88.    }
  89. }
  90. rs.absolute((ShowPage - 1) * PageSize+1); 
  91. //计算欲显示页的第一笔记录位置
  92. %>                                      
  93.                                           <!----------------------one showing unit------------------------------->
  94.    <%
  95. //利用For循环配合PageSize属性输出一页中的记录
  96. int i=1,hw_id,daili,pifa,hw_cash,linshi;
  97. String hw_pic,hw_name,hw_content;
  98. rs.previous();
  99. while(rs.next()&i<= PageSize)
  100. {
  101. i++;
  102.  hw_id=rs.getInt("hw_id");
  103.  hw_pic=rs.getString("hw_pic");
  104.  hw_name=rs.getString("hw_name");
  105.  hw_content=rs.getString("hw_content");
  106.  hw_cash=rs.getInt("hw_cash");
  107.  daili=rs.getInt("daili");
  108.  pifa=rs.getInt("pifa");
  109. %>
  110.         <tr> 
  111.          <td valign="top">
  112.   <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  113.                                                   <tr> 
  114.                                                     <td width="25%" rowspan="5" bgcolor="#FFFFFF" align="left"><a href="views.jsp?hw_id=<%=hw_id%>"><img border="0" src="<%=hw_pic%>" width="120" height="85"></a> 
  115.                                                       <div align="right"></div>
  116.                                                       <div align="right"></div>
  117.                                                       <div align="right"></div>
  118.                                                     </td>
  119.                                                     <td height="25" bgcolor="#FFFFFF" width="75%"> </td>
  120.                                                   </tr>
  121.                                                   <tr> 
  122.                                                     <td height="28" bgcolor="#FFFFFF" width="75%"> 
  123.                                                       <a href="views.jsp?hw_id=<%=hw_id%>"><font color="#006699"><u><%=hw_name%></u></font></a></td>
  124.                                                   </tr>
  125.                                                   <tr> 
  126.                                                     <td height="28" style="line-height:20px" bgcolor="#FFFFFF" width="75%"><%=hw_content%></td>
  127.                                                   </tr>
  128.                                                   <tr> 
  129.                                                     <td height="28" bgcolor="#FFFFFF" width="75%">市场价格:<s><%=pifa%></s>元 本站会员价:<%=hw_cash%>元 VIP价:¥<%=daili%>元<br><a href='javascript:openbag(<%=hw_id%>)'>定购<img border="0" src="img/order.gif" align="middle" width="21" height="15"></a></td>
  130.                                                   </tr>
  131.                                                   <tr> 
  132.                                                     <td height="25" bgcolor="#FFFFFF" width="75%"> </td>
  133.                                      
  134.                                                   </tr>
  135.                                                 </table> 
  136. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  137.                                                   <tr> 
  138.                                                     <td  height="1"></td>
  139.                                                   </tr>
  140.                                                 </table>
  141.   
  142.   </td>
  143.         </tr>
  144.         <%
  145. //下面的if判断语句用于防止输出最后一页记录时, 
  146. //将记录指标移至最后一笔记录之后
  147.  //跳出for循环
  148. }
  149. %>
  150.   <!-----------------------shonwing unit end----------------------------------------------->
  151.                                         
  152.                                     </table>
  153.                                   </td>
  154.                                 </tr>
  155.                               </table>
  156.                             </td>
  157.                           </tr>
  158.                         </table>
  159.                       </td>
  160.                     </tr>
  161.                     <tr> 
  162.                       <td width="100%" height="20"> 
  163.                         <div align="center"></div>
  164.                       </td>
  165.                     </tr>
  166.                     <tr> 
  167.                       <td width=478 height="23"> 
  168.                         <p align="right"><%=RowCount%>第<%=ShowPage%>页/共<%=PageCount%>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <%linshi=ShowPage-1;if(linshi>0){%><a href="sort.jsp?sort_id=<%=sort_id%>&ToPage=<%=linshi%>">上一页</a> 
  169.                           <%
  170.   }else
  171.   {%>
  172.                           上一页 
  173.                           <%}%>
  174.                             
  175.                           <%
  176.   linshi=ShowPage+1;
  177.   if(linshi<=PageCount){%>
  178.                           <a href="sort.jsp?sort_id=<%=sort_id%>&amp;ToPage=<%=linshi%>">下一页</a> 
  179.                           <%
  180.   }else
  181.   {%>
  182.                           下一页 
  183.                           <%}%>
  184.                           </font></p>
  185.                       </td>
  186.                     </tr>
  187.                   </table>
  188.                 </td>
  189.               </tr>
  190.             </table>
  191.           </td>
  192.         </tr>
  193.       </table>
  194.   <!-------------------------right end------------------------------------->
  195.   <%
  196.   }//找到相应的小类的产品
  197.   
  198.   %>