论坛首页 入门技术论坛

pager-taglib--jstl实现分页

浏览 2399 次
该帖已经被评为新手帖
作者 正文
   发表时间:2008-02-26  
<%@ page language="java"  import="java.util.* " pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%@taglib prefix="sql" uri="/WEB-INF/sql.tld" %>
<%@taglib prefix="fn" uri="/WEB-INF/fn.tld" %>
<%@taglib prefix="x" uri="/WEB-INF/x.tld" %>
<%@taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<%@ taglib uri="/WEB-INF/pager-taglib.tld" prefix="pg" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

   
    <title>My JSP 'sp.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  </head>
 
  <body>
     <br>
    
    <sql:query dataSource="${moto}" var="rs">
    select e.EMP_ID,e.USERNAME,e.EMP_TR_NAME,e.EMP_SEX,e.EMP_BIRTH,e.EMP_ID_CARD,e.EMP_TEL,e.EMP_EMAIL,t.US_ST_CO_NAME,t.US_ST_DTRICT,c.COM_NAME,t.TEAM_NAME,d.DEP_NAME,r.US_RA_NAME, p.US_POS_NAME,e.EMP_BUILD_TIME from employees e ,department d ,USER_POSSIE p,COMPANY c ,USER_TEAM t ,USER_RATE r,USER_STATE t where e.U_DEP_ID=d.DEP_ID and e.POSSIE=p.US_POS_ID and c.COM_ID=e.COM_ID and t.TEAM_ID=e.TEAM_ID and e.USERCLASS=r.US_RA_ID and t.US_ST_ID=e.US_ST_ID
    AND e.username like '%${param.user}%' order by e.EMP_ID  asc
    </sql:query>
  
<pg:pager url="sper.jsp" index="half-full" maxPageItems = "3"  maxIndexPages="3" isOffset = "<%=false%>"   export = "pageOffset,currentPageNumber=pageNumber"  scope = "request">  
      
<table style="background:fff;font-size:12;color:999" bgcolor="999" cellSpacing=0 cellPadding=2 width="95%"  align=center border=1 >
<tr align=center>
<td>&nbsp;</td>
    <td>编号</td>
    <td>用户</td>
    <td>姓名</td>
    <td>性别</td>
    <td>所属部门</td>
    <td>所在职位</td>
    <td>手机号码</td>
    <td>EMAIL</td>
    </tr>   
    <c:forEach items="${rs.rows}" var="rs"> 
    <pg:item>  
     <tr>  
<td><input type="hidden" name="usa" value="${rs.EMP_ID}"><a href="javascript:manger(${rs.EMP_ID});">编辑权限</a></td>
<td>${rs.EMP_ID}</td>
<td><a href="javascript:deteils(${rs.EMP_ID});" title="${rs.EMP_TR_NAME}资料明细">${rs.USERNAME}</a></td>
<td>${rs.EMP_TR_NAME}</td>
<td>${rs.EMP_SEX}</td>
<td>${rs.DEP_NAME}</td>
<td>${rs.US_POS_NAME}</td>
<td>${rs.EMP_TEL}</td>
<td>${rs.EMP_EMAIL}</td>
     </tr>       
    </pg:item>  
    </c:forEach>  
</table>
   
  <pg:index>  
   <center>  
    <table border=0 cellpadding=0 width=10% cellspacing=0>  
    <tr align=center valign=top>  
    <td valign=bottom>
    <font face=arial,sans-serif size=-1>Result Page: </font></td>  
    <pg:prev ifnull="true">  

        <c:if test="${pageUrl!=null}">
            <td align=right><A HREF="${pageUrl}"><IMG SRC=http://www.google.com/nav_previous.gif alt="" border=0><br>  
        <b>Previous</b></A></td>
        </c:if>
        <td><IMG SRC=http://www.google.com/nav_first.gif alt="" border=0></td>
        <c:if test="${pageUrl}">
            <td><IMG SRC=http://www.google.com/nav_first.gif alt="" border=0></td>   
        </c:if>
     </pg:prev>
        
    <pg:pages>
      <c:if test="${pageNumber == currentPageNumber}">
           <td><IMG SRC=http://www.google.com/nav_current.gif alt=""><br>  
        <font color=#A90A08>${pageNumber}</font></td>
      </c:if>
      <c:if test="${pageUrl}">
          <td><A HREF="${pageUrl}"><IMG SRC=http://www.google.com/nav_page.gif alt="" border=0><br>${pageNumber}</A></td>
      </c:if> 
    </pg:pages>
   
    <pg:next ifnull="true"> 
    <c:if test="${pageUrl !=null}">
         <td><A HREF="${pageUrl}"><IMG SRC=http://www.google.com/nav_next.gif alt="" border=0><br><b>Next</b></A></td>   
    </c:if>
    <c:if test="${pageUrl !=null}">
     <td><IMG SRC=http://www.google.com/nav_last.gif alt="" border=0></td> 
    </c:if>        
    </pg:next>
      
    </tr>  
    </table>  
  </center>  
  </pg:index>  
  </pg:pager>
   
</body>
</html>

论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics