jsp分页显示完整实例

   2015-06-24 0
核心提示:这篇文章主要介绍了jsp分页显示完整实例,以文章管理页面为例详细分析了jsp的分页显示实现技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了jsp分页显示的实现方法。分享给大家供大家参考。

具体实现方法如下:

复制代码 代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@include file ="../inc/ChkPwd.jsp"%>
<%@include file="../DB.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文章管理</title>
<link href="http://www.lexue001.com/article/Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
 
<table width="98%" height="77%" border="0" cellpadding="0" cellspacing="0">
 <tr class="STYLE1">
      <td width="100%" height="26" background="images/admin_bg_1.gif"><strong><font color="#FFFFFF">--<span class="STYLE1">内容管理</span></font></strong></td>
  </tr>
  <tr>
  <td colspan="10">
  </td>
  </tr>
 
  <tr class="title">
          <td  height="25" background="images/admin_bg_1.gif" class="t2">| 
<%
String op;
String ID = request.getParameter("id");
op = request.getParameter("op");
if(op==null){
 op = "my";
}
if (op.equals("del") && ID!=null){
 String bbb = new String(request.getParameter("BigClassName").getBytes("iso8859_1"));
 Statement stmt_ChannelDEL=conn.createStatement();
 String Sqldel="delete from hl_news where id=" + ID;
 int shan=stmt_ChannelDEL.executeUpdate(Sqldel);
 if (shan>0)
 {
  out.print("<script type="text/javascript"> alert("已成功删除!"); window.location.href='http://www.lexue001.com/article/Hanye_Manages.jsp?BigClassName="+bbb+"'; </script>");
 }
 stmt_ChannelDEL.close();
 return ;
}
 Statement stmtA=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
 String SqlA="Select * from hl_smallclass WHERE bigname='行业新闻' order by id asc";
 ResultSet RsA=stmtA.executeQuery(SqlA);
 while (RsA.next()) {
 
%>
          <a class='t2' href='http://www.lexue001.com/article/Hanye_Manages.jsp?modi=新闻&BigClassName=" target="_blank"><%=img%></a></td>
  
            <td align="center" bgcolor="#BBDAFF" ><%=ttt%></td>
  
            <td width="64" align="center" bgcolor="#BBDAFF" class="STYLE1"><a href="http://www.lexue001.com/article/Hanye_edit.jsp?id=&modi=新闻">修改</a>|<a href="http://www.lexue001.com/article/Hanye_Manages.jsp?id=&op=del&BigClassName=" onclick="return confirm('删除后将不能恢复,你确定删除么?')">删除</a></td>
          </tr>
<%
 if(!RsArticle.next())
  break;
 }
}
%>     
    
    <input name='AllID' type='hidden' value=>
    
      </table>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr class="STYLE1">
    <td width="50%" align="left" background="images/admin_bg_1.gif">
    <span class="t2"><strong></strong>
        
         </span>  
      <label>
       
        </label>
      </td>
          <td width="56%" align="center" background="images/admin_bg_1.gif">
      <div align="left" class="t2">
        共<%=pageCount%>页 <%  for(int i=1;i<=pageCount;i++){  %> <% if(i==showPage){ %><b><%=i %></b><% }else{ %>[<a href='http://www.lexue001.com/article/Hanye_Manages.jsp?BigClassName=&page=&modi=新闻'><%=i %></a>] <% } } %>
           </div></td>
        </tr>
      </table>
   </form>
 <form name="form1" method="post" action="Hanye_Manage.jsp"> <table width="51%" border="0" cellspacing="0" cellpadding="0">
 
      <tr class="t4">
        <td width="34%" height="23"><span class="STYLE1">查询:</span>
          <label>
            <select name="select">
     <option value="ID">按ID查询</option>
     <option value="title">按标题查询</option>
     <option value="times">按时间查询</option>
            </select>
            </label>
          <label>
            <input type="text" name="k">
            <input name="Submit" type="submit" class="t5" value="提交">
            </label>        </td>
      </tr>
    </table>
 </form>
    <br></td>
  </tr>
</table>

<%
RsArticle.close();
stmt_Article.close();
conn.close();
%>
</body>
</html>

希望本文所述对大家的jsp程序设计有所帮助。

 
标签: jsp 分页
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

点击排行