Exercise 6: Paging
/*
First edition copyright 2004 ObjectSource LLC. All rights reserved.
This training material and the accompanying lab exercises were prepared
by Srikanth Shenoy for ObjectSource LLC.
GRANT OF LICENSE: ObjecSource LLC grants you a non-exclusive license to
use the material. No part of this publication may be reproduced, stored
in a retrieval system or transmitted in any form or by any means
electronic, mechanical, photocopying, recording or otherwise, without
the prior written permission of ObjectSource LLC. At its discretion,
ObjectSource LLC may provide limited support through email or discussion
forums at ObjectSource web site. ObjectSource incurs no obligation
to provide any support under this Agreement.
*/
/*
Business Objectives:
The following business objectives will be met at the end of this exercise:
1. Implement Paging
Technical Objectives for this exercise:
The technical objectives of this exercise is to learn how to implement Paging using Pager taglib
a. Start by adding pager taglib to web.xml and CustomerSearchList.jsp
<taglib>
<taglib-uri>/WEB-INF/pager-taglib.tld</taglib-uri>
<taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>
</taglib>
<%@ taglib uri="/WEB-INF/pager-taglib.tld" prefix="pg" %>
b. Use <pg:pager> body tag to cover the entire list display
<pg:pager url="customerlist.do" maxIndexPages="10" maxPageItems="5">
c. Use <pg:item> for each item iterated over
<pg:item>
</pg:item>
<c:forEach var='customer' items='${CUSTOMER_SUMMARY_OBJECTS}'>
</c:forEach>
d. Add a new table containing <pg:index> block with the tags: <pg:prev>, <pg:pages>, <pg:next>
<a href="<%= pageUrl %>"><%= pageNumber %></a>
</pg:pages>
<TABLE width="80%" border="0">
<TR><TD> </TD></TR>
<TR align="center">
<TD>
<pg:index>
<pg:prev><a href="<%= pageUrl%>">[<<Prev]</a></pg:prev>
<pg:pages>
<pg:next><a href="<%= pageUrl%>">[Next>>]</a></pg:next>
</pg:index>
*/
// when I try to deploy the exercise06.jar, some exceptions are printed
/*
SEVERE: Exception sending context initialized event to listener instance of clas
s struts.example.util.ApplicationScopeInit
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:365)
at java.util.Properties.load(Properties.java:293)
at struts.example.util.ApplicationScopeInit.contextInitialized(Unknown S
ource)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3637)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
073)
*/
struts-training.zip( 26,264 k)Related examples in the same category