----- Original Message -----
From: "Rick Reumann" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, November 03, 2003 4:46 PM
Subject: Re: Paging


> Ashish Kulkarni wrote:
>
> > Visit this URL, it works great with struts or any jsp
> > framework
> > http://kulkarni_ash.tripod.com/howto/jsptaglib-howto.html
>
> Yea page not found errors work great with any framework, I agree:0
>
> --
> Rick

?? Well, no problems from here, at least. As it's short
enough, I'll just post it here:

Using JSP taglib for paging

Step 1 download jsp taglib from
http://jsptags.com/tags/navigation/pager/download.jsp

Step 2

Copy pager-taglib.tld in WEB-INF directory of web application
Copy pager-taglib.jar in WEB-INF/lib directory of web application

Step 3 Define tld in web.xml

<taglib>
<taglib-uri>http://jsptags.com/tags/navigation/pager</taglib-uri>
<taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>
</taglib>

Step 4 Define the tag lib in jsp

<%@ taglib uri="/WEB-INF/pager-taglib.tld" prefix="pg" %>

Step 5 Define number of pages to display etc in jsp

<pg:pager maxIndexPages="10"
 maxPageItems="10" export="pagerPageNumber=pageNumber" >

<!-- pagerPageNumber is used by me in the logic to display
      the current page in different color with out link-->

Step 6 Create a loop for displaying data

<% while (crs.next())
<!-where crs is cached row set, this object must be ArrayList,
     Vector, Collection, ResultSet which can be scrolled --  >
<pg:item>
     { %>
<% out.print(crs.getString("L820FIRM").trim()); %>
<% } %>
</pg:item>

Step 7 Logic to display the page numbers and next page
          and previous page arrows for navigation

<pg:index>
<pg:prev>
<a href="<%=pageUrl%>" <!-- some image text to display navigation to
previous page --  > < </a>
</pg:prev>

<pg:pages>
if (pageNumber == pagerPageNumber)
{
// same page so no link here
<%=pageNumber%>
} else
{
// other pages where the user can jump
<a href="<%=pageUrl%>" ><%= pageNumber %></a>
}
</pg:pages>

<pg:next>
<a href="<%=pageUrl%>" <!-- some image text to display navigation to next
page > --  > > </a>
 </pg:next>

</pg:index>

Step 8 end of pager taglib

</pg:pager>

More documentation can be found at
http://jsptags.com/tags/navigation/pager/pager-taglib-2.0.html


HTH,
-- Chris.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to