Hello struts-dev,
I create <logic:pager> tag handler to simplify page by page data
displaying.
Here is short description and sample of use.
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>logic</shortname>
<uri>http://jakarta.apache.org/struts/tags-logic-1.0</uri>
<tag>
<name>pager</name>
<tagclass>org.apache.struts.taglib.logic.PagerTag</tagclass>
<bodycontent>JSP</bodycontent>
<!-- Name to be used in page to refer to this Pager-->
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Name to store Pager tag body in page scope variable - call Pager
once, save result and display it in page at any point. -->
<attribute>
<name>resultId</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Type of labels - page numbers or row ranges. -->
<attribute>
<name>labelType</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Class to use as backend Pager support -->
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Show or not pager in place. Useful to generate pager and show it
multiple times. -->
<attribute>
<name>show</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Name of the page scope variable (Integer) with offset of the
first row.-->
<attribute>
<name>offset</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Length of the page. -->
<attribute>
<name>pageSize</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Total length of the list. -->
<attribute>
<name>totalSize</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Name for the paramater name (in URL) to be used as page size.
-->
<attribute>
<name>pageSizeName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- Name for the paramater name (in URL) to be used as offset.
-->
<attribute>
<name>offsetName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
Sample of JSP page with pager tag -
<bean:define id="offset" name="newsSlide" property="offset"
type="java.lang.Integer"/>
<bean:define id="pageSize" name="newsSlide" property="slideLength"
type="java.lang.Integer"/>
<bean:define id="totalSize" name="newsSlide" property="totalLength"
type="java.lang.Integer"/>
<logicext:pager id="pager" resultId="pagerPanel"
show="false" offset="offset" pageSize="pageSize"
totalSize="totalSize">
<logic:greaterThan name="pager" property="pagesTotal" value="1">
<table>
<tr>
<td>
<logic:equal value="true" property="hasPrev" name="pager">
<html:link property="prev.link" name="pager" forward="news">Prev</html:link>
</logic:equal>
<logic:equal value="false" property="hasPrev" name="pager">Prev</logic:equal>
</td>
<logic:iterate property="linksIterator" name="pager" id="pagerItem">
<td>
<logic:equal value="false" property="isCurrent" name="pagerItem">
<html:link property="link" name="pagerItem" forward="news">
<bean:write property="label" name="pagerItem"/>
</html:link>
</logic:equal>
<logic:equal value="true" property="isCurrent" name="pagerItem">
<bean:write property="label" name="pagerItem"/>
</logic:equal>
</td>
</logic:iterate>
<td>
<logic:equal value="true" property="hasNext" name="pager">
<html:link property="next.link" name="pager" forward="news">Next</html:link>
</logic:equal>
<logic:equal value="false" property="hasNext" name="pager">Next</logic:equal>
</td>
</tr>
</table>
</logic:greaterThan>
</logicext:pager>
<bean:write name="pagerPanel" filter="false"/>
.... page of the list
<bean:write name="pagerPanel" filter="false"/>
--
Best regards,
Oleg mailto:[EMAIL PROTECTED]