struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Kulkarni <kulkarni_ash1...@yahoo.com>
Subject Re: paginator tags
Date Fri, 07 Mar 2003 15:20:19 GMT
Hi
here is how to define the taglib in web-inf
<taglib>
<taglib-uri>http://jsptags.com/tags/navigation/pager</taglib-uri>
<taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>
</taglib>


Here is in nutshell all u need to do for setting
paging tablib in jsp
//declare jsp tag in taglib
<%@ taglib
uri="http://jsptags.com/tags/navigation/pager"
prefix="pg" %>
<pg:pager maxIndexPages="3"
 maxPageItems="10"
export="pagerPageNumber=pageNumber" >
<!--i use cached row set to store the data, resut is a
bean defined, i dont want to build a bean and an array
list of that bean etc to handle paging-->
CachedRowSet crs = result.getCachedData();
<!-- start your loop to display data from arraylist or
result set -->
<% while (crs.next())
  {
  %>
  <pg:item>
  <%
<!-- the code to build table code will go here
-->
  </pg:item>
<!-- logic to get the build the page number and images
so u can do pagin
-->
<pg:index> 

<!-- for previos page i use a image here-->
<pg:prev>
 
<a href="<%= pageUrl %>"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('left','','../images/en/buttons/arrow_left_on.gif',1)"><img
name="left" border="0"
src="../images/en/buttons/arrow_left_off.gif"
width="30" height="30" align="absmiddle"></a>
  </pg:prev> 

<!-- for page numbers like in google -->

<pg:pages>
 <a class="pageNum" href="<%= pageUrl %>" ><%=
pageNumber %></a>
 </pg:pages> 

<!-- for next page-->

<pg:next>
 <a href="<%= pageUrl %>"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('right','','../images/en/buttons/arrow_right_on.gif',1)"><img
name="right" border="0"
src="../images/en/buttons/arrow_right_off.gif"
width="30" height="30" align="absmiddle"></a>

</pg:next> 

</pg:index> 
<!-- end of pager-->
</pg:pager>
                    

                     
I hope this helps
I am also attaching one of the jsp along this mail for
your reference

Ashish








--- Richard Raquepo <rraquepo@primeorion.com> wrote:
> Can you give me actual jsp code on how you used the
> pager tag. i find it
> hard to customize it. thanks
> ----- Original Message -----
> From: "Ashish Kulkarni" <kulkarni_ash1312@yahoo.com>
> To: "Struts Users Mailing List"
> <struts-user@jakarta.apache.org>
> Sent: Friday, March 07, 2003 5:36 AM
> Subject: Re: paginator tags
> 
> 
> > Hi
> > u may wanna have a look at this
> > http://jsptags.com/tags/navigation/pager/index.jsp
> >
> > it works well for me
> >
> > Ashish
> >
> > --- alexj <alexj@freesurf.ch> wrote:
> > > you may use <display tag> or struts-el
> > > here is a sample from JSTL in Action :
> > > <%@ taglib prefix="c"
> > > uri="http://java.sun.com/jstl/core" %>
> > >
> > > <c:set var="totalCount" scope="session"
> > > value="100"/>
> > >
> > > <c:set var="perPage" scope="session"
> value="20"/>
> > >
> > > <c:forEach
> > >
> > > var="boundaryStart"
> > >
> > > begin="0"
> > >
> > > end="${totalCount - 1}"
> > >
> > > step="${perPage}">
> > >
> > > <a href="?start=<c:out
> value="${boundaryStart}"/>">
> > >
> > > [
> > >
> > > <c:out value="${boundaryStart}"/>
> > >
> > > -
> > >
> > > <c:out value="${boundaryStart + perPage - 1}"/>
> > >
> > > ]
> > >
> > > </a>
> > >
> > > </c:forEach>
> > >
> > > <c:forEach
> > >
> > > var="current"
> > >
> > > varStatus="status"
> > >
> > > begin="${param.start}"
> > >
> > > end="${param.start + perPage - 1}">
> > >
> > > <c:if test="${status.first}">
> > >
> > > <ul>
> > >
> > > </c:if>
> > >
> > > <li><c:out value="${current}"/></li>
> > >
> > > <c:if test="${status.last}">
> > >
> > > </ul>
> > >
> > > </c:if>
> > >
> > > </c:forEach>
> > >
> > > --
> > > Alexandre Jaquet
> > > ----- Original Message -----
> > > From: "Jacky Kimmel" <rjkimme@yahoo.com>
> > > To: <struts-user@jakarta.apache.org>
> > > Sent: Thursday, March 06, 2003 9:22 PM
> > > Subject: paginator tags
> > >
> > >
> > > >
> > > > Does anyone know how to implement paginator
> tags?
> > > Ie: you have a list of
> > > 30 items out of 100.  You now want to display
> the
> > > next 30 and so on.
> > > >
> > > >
> > > >
> > > > Also, I am using application.resource for all
> > > labels.  I want to have a
> > > name with a trademark symbol as a superscript.
> > > Anyone know how to do this?
> > > >
> > > >
> > > >
> > > > ---------------------------------
> > > > Do you Yahoo!?
> > > > Yahoo! Tax Center - forms, calculators, tips,
> and
> > > more
> > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > >
> >
> >
> > =====
> > A$HI$H
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - forms, calculators, tips, more
> > http://taxes.yahoo.com/
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

Mime
View raw message