Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pagination using display tag and JSTL.Display problem

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
Im trying to build an enhancement to my web app, by including pagination to diplay the results of a query in the jsp. I ve tried using the diplay tag library to implement the same .Before using the display tag library , I was just printing the List by using jstl tags and EL , something of the nature below.

which shows the following output
Code Description IsActive? IsEditable? Edit
SINGLE FEMALE Yes No Edit
SINGLE MALE Yes No Edit
MARRIED MALE Yes Yes Edit
where 'Edit' is a hyper link.


I did look at a couple of samples of display tag library and modified my code to the following.

However , now when I try to print the results, I get a weird output . As the records are repeated horizontally across the across the table defined in addition to the normal vertical listing.
also, the records are not listed accordint to the table structure that I have defined.
The output here is.
7 items found, displaying 1 to 2.[First/Prev] 1, 2, 3, 4 [Next/Last]
Code Description IsActive? IsEditable? Edit
SINGLE FEMALE Yes No SINGLE MALE Yes No MARRIED MALE Yes Yes MARRIED FEMALE Yes Yes Married Male Yes No Married Female Yes No Married Female Yes No
SINGLE FEMALE Yes No SINGLE MALE Yes No MARRIED MALE Yes Yes MARRIED FEMALE Yes Yes Married Male Yes No Married Female Yes No Married Female Yes No

And the hyper link associated with 'Edit' is not being displayed either .

Any help would be appreciated.

EDIT:further details added.
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide the screenshots if possible. Also provide the log. It would help us to analyze the issue faster.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ravi,
Thanks for replying.I've attached the screenshots of the scenario before and after adding pagination.
Also , the hyper link 'Edit' is absent in the latter case.
BeforeUsingDisplayTag.JPG
[Thumbnail for BeforeUsingDisplayTag.JPG]
AfterUsingDisplayTag..JPG
[Thumbnail for AfterUsingDisplayTag..JPG]
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And FYI, there is no change in log ,a s the log generated is same for both cases
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Moderators,
Is this the wrong forum to post this query?
If yes , please move to the right forum . As i needed some urgent help
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Please chk the above code and verify it. I think this is just an small issue.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi,
Thanks for replying. However there was no change in output despite using your code. I still get Multiple tables of the result set placed side by side.
Even when I say page size ="2", the attribute that defines the no of rows displayed , there are multiple tables of the result set placed side by side, why is this happening ?
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the example or the basic tutorialfor the tag library. I have never used the library before, but it seems like it is supposed to completely replace the need for using the templated html.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike ,
Thanks for replying . I did write my code based on the examples that you have cited . Do you suggest any change in my existing code ?
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is some code fragment for how I think it should work. You should not have any templated html for creating the table, columns, or rows.

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,
Thanks for replying. I tried your code fragment , but says "Nothing found to display" . I also tried replacing the property attribute with the value attribute , it threw a number format exception .
Any ideas on where i could be going wrong?
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never used that tag library before so I can't help any further. You may want to try subscribing to the project mailing list
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying Mike! I did join the mailing list and ask the query however havent received any replies from them . Im just hoping someone else from here could try to help?
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

The snippet that Mike gave above should work, you can also put the list straight in using EL, like:
Try that and see what you get. Keep it simple to start with, you can add in the other columns later.

Sean
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Sean , that particular snippet ,helped me out .even though im stuck at another point in the app, your code snippet was really helpful.
Thanks
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sean ,
One more thing , the snippet is working fine . However,Is there any way icould put a link as a column,something I achieve through this

using plain jsp using display tags??
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vic Hood wrote:
However,Is there any way icould put a link as a column,something I achieve through this
view plaincopy to clipboardprint?


using plain jsp using display tags??


what's stopping you from doing that ? as pointed out before, did you check the display tag column reference ? it has a 'href' attribute in which you can show the column values as links.


taken from the sourceforge website....

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi robin,
thanks for the reply . I did look at that link . and write my code , however I m facing another problem that I've entailed in
http://www.coderanch.com/t/539212/open-source/Displaying-link-display-tag.
As i marked this one as closed.:S
Please have a look at that .
Thank you for replying .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic