Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display:table pagination control?

 
Weston Kornfeld
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a .jsp that uses the display:table mechanism for displaying a table, i.e.:

<display:table name="myName" id="camp" cellspacing="2" cellpadding="0" defaultsort="3" sort="list" pagesize="15" requestURI="<%=myURI%>" width="100%">

It appears that it handles pagination automatically - i.e. pagesize will display 15 rows and then does a page break.

What I need to do is this:

In my app this display:table mechanism displays a series of row - each row has a link that can take them to another page - on the other page - there is a link that will bring them back to this orignal .jsp with the above code - but when they come back they want to come back to the paginated page from whence they came - so if they were on paginated page 2 when they left - they want to come back to paginated page 2 rather than page 1, which looks like the default - (to prevent them from having to re-navigate from whence they came). I would think this is a very common issue.


Many Thanks
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may need to invoke the same logic when user clicks the link on the 'other' page. For this, a parameters needs to be passed when the user clicks link on the 'original' page
 
Christian Nash
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Could you please post the sample code for pagination using display tags.

Thanks,
ashwin
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Kornfeld is talking about displayTag Lib (http://displaytag.sourceforge.net). I'm also facing this issue. As for Mohan, calling with same params does not work. It eventually takes the usre the 1st page.

Bye,
Viki.
 
amit k bhardwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Issue: We were facing the issue for display:table pagination control, when on the click of page 2, the UI of page wasn't same as in the page 1. Actually there are js,css and images are missing for next page or whenever we navigate through the page 2 to page1.

Solution: This is happening because in the jsp file we have given the path like below in our case:

<link href="../css/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="../css/style1.css" rel="stylesheet" type="text/css" media="screen" />

while it should be

<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/style1.css" rel="stylesheet" type="text/css" media="screen" />

This is similer for all the files included into jsp like css, js and images files.

and we have placed the same jsp file directly inside webcontent folder.

Please revert back in case of any query.

Regards,
Amit
 
Niiraj Patel
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Quote:
Hi all,

Could you please post the sample code for pagination using display tags.

Thanks,
ashwin


@Nash,

You can have a look at this thread. http://www.coderanch.com/t/554090/Struts/Struts-Display-tag
I have posted eclipse project which uses struts 2.0 and Display tag library 1.2.

-Niraj
 
amit k bhardwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

Please refer the below link for Display tag use in the code for struts application:

http://www.vaannila.com/struts/struts-example/struts-display-tag-table-decorator-example-1.html

Hope above link will helpful. In case of any other query please write back....


Regards,
Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic