Senthil.... Not sure if you still need this info, but here goes
anyway. Also... At the end of all this I have a question to the group
about DisplayTag and Struts. Sorry for the long winded-ness of this
email... Usually I need a little more hand holding than just a "check
out this web site" answer, so maybe this will be helpful to someone
else as well.
I am in the process of using DisplayTag in a Struts app I'm
converting at this time. It took a while for me to figure it all out,
but then again it's probably just me. When you go to the DisplayTag
web site (displaytag.sourceforge.net), pay close attention to Step #2
on the "Install" reference page. I had to pull down the latest
version of the required commons-*.jar and log4j.jar files. My older
versions caused problems. Other than that here's what I did to make
it work for me:
1) added reference to the taglib in my web.xml
<taglib>
<taglib-uri>http://displaytag.sourceforge.net/</taglib-uri>
<taglib-location>/WEB-INF/xml/displaytag.tld</taglib-location>
</taglib>
NOTE: I tend to like the tld files some place where I can see and
touch them so I extracted the displaytag.tld from the jar file.
Probably not necessary, but I'm old(er), going bald and just set in
my ways.
2) here's my jsp... Things to note:
* I linked in a special stylesheet to deal with the rendering of the
tables.
I extracted (from the example war file) the displaytag.css file
made some
minor changes like changing the default table references to
table.dptag
so that it wouldn't conflict with the "normal" css data for the
rest of the site.
* My Action class returns List objects and some List objects "in" a
List. The first
<display:table> is rendering a table based on a List that is
placed in the request scope.
It is referenced by just the requestScope name
multiTermSearchResults. The id
property allows the <bean:write> to retrieve a property from the
objects getter.
* The "empty" requestURI allows the paging links to go back to my
initial
Action class for re-display of the requested page.
* The second <display:table> is inside a <logic:iterate> because the
table(s) is
based on data from Lists inside a List. The iterate makes the
internal Lists
available in the pageScope under the id of "terms".
<display:table> can then
gain access to the internal List(s) by using the property name
pageScope.terms.resultEntries.
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/xml/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/xml/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/xml/displaytag.tld" prefix="display" %>
<link rel="stylesheet" media="all" type="text/css" href="/
displaytag.css"/>
<!-- BEGIN MULTIPLE WORD RESULTS TABLE(S) -->
<display:table id="multirow" name="multiTermSearchResults"
class="dptag" pagesize="15" requestURI="">
<display:column title="Handbook Document" >
<A HREF='<bean:write name="multirow" property="url"/
>'><bean:write name="multirow" property="title"/></A>
</display:column>
<display:column title="Score" >
<bean:write name="multirow" property="score"/>
</display:column>
</display:table>
<!-- END MULTIPLE WORD RESULTS TABLE(S) -->
<!-- BEGIN SINGLE WORD RESULTS TABLE(S) -->
<logic:iterate id="terms" name="wordSearchResults">
<display:table id="row" name="pageScope.terms.resultEntries"
class="dptag" pagesize="15" requestURI="">
<display:column title="Handbook Document" >
<A HREF='<bean:write name="row" property="url"/
>'><bean:write name="row" property="title"/></A>
</display:column>
<display:column title="Score" >
<bean:write name="row" property="score"/>
</display:column>
</display:table>
</logic:iterate>
<!-- END SINGLE WORD RESULTS TABLE(S) -->
So with all that said.. Here's my question to the group. Does anyone
have experience with the actual Action class(es) necessary to
accomplish the paging? Here's what I'm seeing. "IF" my page is
rendered with just one <display:table> entry then the paging works as
expected. Going back through my initial Action class and coming back
to the jsp accomplishes the paging as expected. What gets weird is
when there are multiple tables rendered via DisplayTag. What happens
then is that hitting the "Next Page" link on one window causes "ALL"
windows to cycle to the next page. I'm sure it has to do with the
parameters that are being passed between the jsp and the action and
then back to the jsp. What I'm not seeing is how to differentiate the
multiple tables so that the paging action only happens on the table
requested. Any responses and/or examples would be appreciated.
Thanks in advance, ajTreece
On Jul 24, 2006, at 1:15 AM, senthil.s wrote:
Hi All
Anyone can tell me the process of using DisplayTag for
Pagination in struts.
With Regards
Senthil.S
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed. If you have received this email in error please
notify the system manager. Please note that any views or opinions
presented in this email are solely those of the author and do not
necessarily represent those of IC Infotech. Finally, the recipient
should check this email and any attachments for the presence of
viruses. IC Infotech accepts no liability for any damage caused by
any virus transmitted by this mail.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]