File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Pagination using display tag and JSTL.Display problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Pagination using display tag and JSTL.Display problem" Watch "Pagination using display tag and JSTL.Display problem" New topic
Author

Pagination using display tag and JSTL.Display problem

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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.


Learning and Learning!-- Java all the way!
Ravi Majety
Ranch Hand

Joined: Feb 26, 2009
Posts: 59

Please provide the screenshots if possible. Also provide the log. It would help us to analyze the issue faster.
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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.


[Thumbnail for BeforeUsingDisplayTag.JPG]

[Thumbnail for AfterUsingDisplayTag..JPG]

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

And FYI, there is no change in log ,a s the log generated is same for both cases
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

@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

Joined: Feb 26, 2009
Posts: 59



Please chk the above code and verify it. I think this is just an small issue.
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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

Joined: May 04, 2011
Posts: 144

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.


OCJP6, OCWCD5
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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

Joined: May 04, 2011
Posts: 144

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

Joined: Jan 05, 2011
Posts: 477

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

Joined: May 04, 2011
Posts: 144

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

Joined: Jan 05, 2011
Posts: 477

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

Joined: Jul 15, 2009
Posts: 377

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


I love this place!
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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

Joined: Jan 05, 2011
Posts: 477

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

Joined: Sep 10, 2008
Posts: 270

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....



Time is what we want the most, but what we use the worst. -- William Penn
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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 .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagination using display tag and JSTL.Display problem
 
Similar Threads
Jstl not reflecting values back to servlet
Problem with c:foreach not working
Dynamic table not displaying.
Retaining drop down values on page submit
List of beans returning empty