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

Applet

开发平台:

Java

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