right.jsp
上传用户:szlmxq
上传日期:2014-01-31
资源大小:740k
文件大小:9k
源码类别:

Applet

开发平台:

Java

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