• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pagination through Struts2 Action Classes

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on application using Spring, Struts2, Hibernate. Now i have completed Spring Configuration with Hibernate Mapping using MVC Architecture.

Now i am working on View Side using Struts2 Action Classes. I want to apply pagination concept in my all d forms. For e.g. if i have 1000 records in my table, then it should display me 100 pages & each page contains 10 records.

Anyone have proper logic for that ? Thanks in advance...
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Why you want to develop your own logic for pagination.

There are already one third party tool available which makes your life easy.

This is wonderful tool or say application which you can integrate to your application for paging your page.

I give you the link for that.

First refer it and if you find any difficulty then let me know ........

http://displaytag.homeip.net/displaytag-examples-1.1/

you can find example here for different type of pagination.


 
Nirmal Jatania
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Nishan

Thanks for your response.

Ya, i gone through with d DisplayTag Lib 1.2 & execute its in built application too.

I understood the inbuilt property of displayTag. But i am still confuse that how to integrate it with struts2 action class.

I have already created action class of struts2. But don't know how to integrate displayTag with struts2 Action Classes.

Can you please provide me any link of example that show me the integration of both ? or any code that could help me...

Thanks in advance....

Nirmal.
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi,

You don't have to make more configuration.

Just add display tag jar in your project.

In action just set your list which you want to display at your application.

After add taglib directive at your jsp then you can use the tag of display tag.


Just give your list name to your display tag table element list="your list name" .

Then use <display: column tag and use property for display it.


>
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

For better understanding use this


http://displaytag.sourceforge.net/10/install.html


 
Nirmal Jatania
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nishan,

As you suggested i have gone through with tutorial of DisplayTag.

At the time of running my application, i am getting some error like :

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: javax.servlet.ServletException: Exception: [.LookupUtil] Error looking up property "id" in object type "java.lang.String". Cause: Unknown property 'id'

root cause

javax.servlet.ServletException: Exception: [.LookupUtil] Error looking up property "id" in object type "java.lang.String". Cause: Unknown property 'id'

root cause

Exception: [.LookupUtil] Error looking up property "id" in object type "java.lang.String". Cause: Unknown property 'id'

root cause

java.lang.NoSuchMethodException: Unknown property 'id'

note The full stack traces of the exception and its root causes are available in the Sun GlassFish Enterprise Server v2.1 logs.



My startup page of jsp is welcome.jsp. It has following code :



It works fine & calls the action class called as allCountry.action. That action class has following code :



Now SUCCESS is redirecting my application to country.jsp. That is the file where i want to apply pagination. It has following code :



Any Idea.... Please reply soon... Thanks in advance...
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't displaytag require that the list is in a JEE scope?
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nirmal,

It seems like your display tag did not locate your list properly, it seem to be iterating over String array, instead of Country one. At this point method:

getCountryList() should be called. Any chance you have method with this name returning list of Strings (as so logs indicate)?

Btw. requestURI seem not to be valid. You should put either valid uri, or leave it blank.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic