TheOtherPages Pagination Framework by Shrikant Vashishtha

1,058 views
971 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,058
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • It may become a performance bottleneck if we fetch all rows form database. 2. Users may want to see one page at a time.  Imagine Google showing all pages at once.
  • 1  Talk about pagination concerns  Get the search query, talk to business logic to get the data  caching the data and search query etc  Everybody writes their own pagination logic 2. Even there it’s good enough for simple pages with less data. It doesn’t have the notion of caching the data and no notion on how to handle server side consistently.
  • Shouldn’t need any interfaces or abstract methods to be implemented by DAO or Service layer 3. Reuse of existing framework like displaytag. No need to reinvent the wheel. At the same time it should be easier for existing users to use this framework. 4. View Independent  Show the relationship with making it HTTP independent
  • Show an example for the same. 2. Problem with legacy code. Don’t want to change the legacy code block. However a problem as catching Exception will catch the runtimeexception also. 3. Created PaginationCacheStore interface and its application level and session level implementation. 4. Needed to remove the frequent access to database. Using Caching framework independent implementation.
  • Option 1  You can pass this object to displaytag as an usual list, and it will extract paging and sorting information from it.
  • This is a must when used with partial lists The purpose of this property is for convenience when writing the backend code that actually does the sorting of the data. For example the header link for the column with property id in the sample code above will render a link containing d-(encoded table id)-s=id. If you remove the sortName property from the column the link will instead contain d-(encoded table id)-s=0, which is the index of the column rather than the name. 4. You do this by storing the total list size in a java.lang.Integer object and putting it into some scope available to DisplayTag.
  • Show an example for the same. 2. Problem with legacy code. Don’t want to change the legacy code block. However a problem as catching Exception will catch the runtimeexception also. 3. Created PaginationCacheStore interface and its application level and session level implementation. 4. Needed to remove the frequent access to database. Using Caching framework independent implementation.
  • TheOtherPages Pagination Framework by Shrikant Vashishtha

    1. 1. ShriKant Vashishtha, Sep 17, 2008 TheOtherPages – A Pagination Framework
    2. 2. Why Pagination? <ul><li>Performance Reasons </li></ul><ul><li>Usability </li></ul>
    3. 3. Why yet another framework? <ul><li>No existing framework for server-side pagination concerns. </li></ul><ul><li>Existing frameworks like Display tag library are mostly concerned about View part </li></ul>
    4. 4. Design Constraints <ul><li>Non-Intrusive </li></ul><ul><li>Very simple client interface </li></ul><ul><li>Shouldn’t require many changes in existing code. </li></ul><ul><li>Reuse </li></ul><ul><li>Configurable for each web-page </li></ul><ul><li>View Independent  should be able to work with any view technology </li></ul><ul><li>Independent from any data access implementation </li></ul>
    5. 5. Design Decisions <ul><li>Usage of inner class (Callback) for loose coupling with Service and DAO layer </li></ul><ul><li>Usage of Exception as throws clause in the framework </li></ul><ul><li>Constructor Injection in PaginationService implementation. </li></ul><ul><li>HTTP independent. </li></ul><ul><li>Cached/No-cache the data coming from data-store </li></ul><ul><li>The concept of PaginationCallback and PaginationCallbackParams. </li></ul>
    6. 6. Display tag integration <ul><li>Partial List Support – Handle pagination and sorting by yourself </li></ul><ul><li>Integration options </li></ul><ul><ul><li>Object implements org.displaytag.pagination.PaginatedList interface </li></ul></ul><ul><ul><li>Pass all the needed parameters as separate tag attributes </li></ul></ul>
    7. 7. Display tag integration <ul><li><display:table name=&quot;testList&quot; sort=&quot;external&quot; defaultsort=&quot;1&quot; pagesize=&quot;20“ id=&quot;element“ partialList=&quot;true&quot; size=&quot;resultSize&quot; > </li></ul><ul><li><display:column property=&quot;id&quot; title=&quot;ID&quot; sortable=&quot;true&quot; sortName=&quot;id&quot; /> </li></ul><ul><li><display:column property=&quot;firstName&quot; sortable=&quot;true&quot; sortName=&quot;firstName&quot; title=&quot;First Name&quot; /> </li></ul><ul><li><display:column property=&quot;lastName&quot; sortable=&quot;true&quot; sortName=&quot;lastName&quot; title=&quot;Last Name&quot; /> </li></ul><ul><li><display:column property=&quot;address&quot; sortable=&quot;true&quot; sortName=&quot;address&quot; title=&quot;Email Address&quot;/> </li></ul><ul><li></display:table> </li></ul>Already sorted before tag gets it Used for sorting in backend code Data for page comes from backend Total size of list Page Size
    8. 8. Design Patterns Used <ul><li>Template Method </li></ul><ul><li>Proxy </li></ul><ul><li>Singleton </li></ul>

    ×