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

百货/超市行业

开发平台:

Java

  1. <!-------------------------right begin------------------------------------->
  2. <table width="560" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom: 6">
  3.   <!--DWLayoutTable-->
  4.   <tr> 
  5.     <td width="560" height="328" valign="top" bgcolor="#FFFFFF"> 
  6.       <table width="560" height="5" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  7.         <!--DWLayoutTable-->
  8.         <tr> 
  9.           <td> <p align="center"> 
  10.           <a target="_blank" href="http://www.jspshop.cn/"> 
  11.               <img src="img/banner.gif" width="575" height="118" border="0"></a></td>
  12.           <td width="1"></td>
  13.         </tr>
  14.         <tr> 
  15.           <td width=478 height="2" style="border-bottom:#cccccc 1px solid" bgcolor="f7f7f7"> 
  16.             <table width="100%" border="0" cellspacing="0" cellpadding="0">
  17.               <tr> 
  18.                 <td width="8%"> </td>
  19.                 <td height="25" valign="middle"> <b><%=Nsort_name%></b>型号列表 | 
  20.                   <%
  21.    sql="select *  from Nsort where sort_id="+sort_id+" and Nsort_id<>"+nsort_id;
  22.         rs=mdb.executeQuery(sql);
  23. if(rs.next())
  24. {
  25. %>
  26.                   <font color="#0000FF">相关小类</font>|-- 
  27.                   <%
  28. rs.previous();
  29. while(rs.next())
  30. {
  31. %>
  32.                   |<a href="nsort.jsp?sort_id=<%=sort_id%>&nsort_id=<%=rs.getInt("Nsort_id")%>"><%=rs.getString("Nsort_name")%></a> 
  33.                   <%
  34.          }
  35. }
  36.         rs.close();
  37.       %>
  38.                 </td>
  39.               </tr>
  40.             </table></td>
  41.           <td></td>
  42.         </tr>
  43.         <tr> 
  44.           <td width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
  45.               <tr> 
  46.                 <td valign="top"> <div align="center"> </div>
  47.                   <table width="99%" border="0"cellspacing="0" cellpadding="0" align="center">
  48.                     <tr> 
  49.                       <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" >
  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+" and Nsort_id="+nsort_id;
  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"> <table width="100%" border="0" align="center"cellspacing="0">
  112.                                 <tr> 
  113.                                   <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> 
  114.                                     <div align="right"></div>
  115.                                     <div align="right"></div>
  116.                                     <div align="right"></div></td>
  117.                                   <td height="25" bgcolor="#FFFFFF" width="75%"> </td>
  118.                                 </tr>
  119.                                 <tr> 
  120.                                   <td height="28" bgcolor="#FFFFFF" width="75%"> 
  121.                                     <a href="views.jsp?hw_id=<%=hw_id%>"><font color="#006699"><u><%=hw_name%></u></font></a></td>
  122.                                 </tr>
  123.                                 <tr> 
  124.                                   <td height="28" style="line-height:20px" bgcolor="#FFFFFF" width="75%"><%=hw_content%></td>
  125.                                 </tr>
  126.                                 <tr> 
  127.                                   <td height="28" bgcolor="#FFFFFF" width="75%">市场价格:<s><%=pifa%></s>元 本站会员价:<%=hw_cash%>元 VIP价:¥<%=daili%>元<br>
  128.                                     <a href='javascript:openbag(<%=hw_id%>)'>定购<img src="img/order.gif" width="21" height="15" border="0" align="middle"></a></td>
  129.                                 </tr>
  130.                                 <tr> 
  131.                                   <td height="25" bgcolor="#FFFFFF" width="75%"> </td>
  132.                                 </tr>
  133.                               </table>
  134.                               <table width="100%" border="0" cellspacing="0" cellpadding="0">
  135.                                 <tr>
  136.  <td height="1"></td>
  137.                                 </tr>
  138.                               </table></td>
  139.                           </tr>
  140.                           <%
  141. //下面的if判断语句用于防止输出最后一页记录时, 
  142. //将记录指标移至最后一笔记录之后
  143.  //跳出for循环
  144. }
  145. %>
  146.                           <!-----------------------shonwing unit end----------------------------------------------->
  147.                         </table></td>
  148.                     </tr>
  149.                   </table></td>
  150.               </tr>
  151.             </table></td>
  152.           <td></td>
  153.         </tr>
  154.         <tr> 
  155.           <td width="100%" height="20"> <div align="center"></div></td>
  156.           <td></td>
  157.         </tr>
  158.         <tr> 
  159.           <td width=478 height="23"> <p align="right">第<%=ShowPage%>页/共<%=PageCount%>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  160.               <%linshi=ShowPage-1;if(linshi>0){%>
  161.               <a href="nsort.jsp?sort_id=<%=sort_id%>&ToPage=<%=linshi%>&nsort_id=<%=nsort_id%>">上一页</a> 
  162.               <%
  163.   }else
  164.   {%>
  165.               上一页 
  166.               <%}%>
  167.                 
  168.               <%
  169.   linshi=ShowPage+1;
  170.   if(linshi<=PageCount){%>
  171.               <a href="nsort.jsp?sort_id=<%=sort_id%>&ToPage=<%=linshi%>&nsort_id=<%=nsort_id%>">下一页</a> 
  172.               <%
  173.   }else
  174.   {%>
  175.               下一页 
  176.               <%}%></font>
  177.               </p></td>
  178.           <td></td>
  179.         </tr>
  180.       </table></td>
  181.   </tr>
  182. </table>
  183.   <!-------------------------right end------------------------------------->
  184.   <%
  185.   }//找到相应的小类的产品
  186.   
  187.   %>