一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jsp 分页程序代码

时间:2009-09-29 编辑:简简单单 来源:一聚教程网

jsp 分页程序代码

<%
 String s;
 String theurl;
 theurl="products.jsp?";
 s=request.getParameter("s");
 if(s!=null){
  s=new String(request.getParameter("s").getBytes("iso-8859-1"));
  theurl="products.jsp?s="+s;
 }
 Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
 ResultSet Rs=stmt.executeQuery("Select * from hl_smallclass WHERE modiname='产品'");
 while (Rs.next()) {
 String smallname = Rs.getString("smallname");
%>
     
        ::<%=smallname%>::
     
<%
}
 Rs.close();
%>
   
 
   


     
       
       
     
     
       
     
   
首页 > 产品展示 > <%  if(s!=null){ out.print(s); } %>

         
           
         
       
以下为我公司<% if(s!=null){ out.print(s); } if(s==null){    %>所有<% }%>产品;点击相应的图片或文字进入查看详细产品信息

         
         
           
         
       

   
   
   
      
<%
int pageSize=9;
int showPage=1;
int recCount=0;
int t=0;
int pageCount=0;
String toPage = request.getParameter("page");
String sqlp;
  sqlp="Select * from hl_product order by ID desc";
 if(s!=null){
  sqlp="Select * from hl_product WHERE smallname='"+s+"'";
 }
 ResultSet RsA=stmt.executeQuery(sqlp);
if(RsA.next()) { 
 RsA.last();
 recCount=RsA.getRow();
 pageCount=((recCount%pageSize)==0?(recCount/pageSize):(recCount/pageSize)+1);
 if(toPage!=null)
  showPage=Integer.parseInt(toPage);
  RsA.absolute((showPage-1)*pageSize+1);
 for(int i=1;i<=pageSize;i++){
 String ttt = RsA.getString("title");
 //ttt=ttt.substring(0,10);
 int ID=RsA.getInt("ID");
%>
   
                         
<% 
 t++;
 if (i%3==0)  out.print("");

 if(!RsA.next())
  break;
 }

}
 RsA.close();
%>

   


           

    
                     
                       
                     
                     
                       
                     
                 

                           
                             
                           
                       
" alt="" width="190" height="120" border="0" onerror="javascript:this.src='images/nopic.gif'"/>
<%=RsA.getString("title")%>

  


 
             


                                          action="news.asp?classid=&bigclassname=新闻在线"
                          method="post" name="showpages" id="showpages">
                 
                   
                     
                   
                 
               
               
                 
               
             
<% if(showPage>1){ %>首页 <% } if (showPage>1) { %>上一页 <% } if (showPage 下一页 <% } %> <% if(showPage尾页 <%       } %> 页次:<%=showPage %>/<%=pageCount%>页 共有<%=recCount%>条记录 转到第

             

     
 

<%
stmt.close();
%>

热门栏目