没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
oss.trustie.net/open_source_projects | 主页 > 开源项目社区 > displaytaglibrary-extention |
displaytaglibrary-extention
|
0 | 0 | 0 |
贡献者 | 讨论 | 代码提交 |
Following changes are made in Display Tag 1.0 tag library code and tag library descriptor in order to meet specific requirements.
1. A new tag-attribute “defaultPage” of type “int” has been added to the TableTag. The org.displaytag.tags.TableTag.java code has been modified to add this attribute as well as associated getter-setter methods. In the initParameters () method of TableTag class, the logic to initialize the “pageNumber” instance variable has been modified. If user has provided the value to the “defaultPage” attribute, it should be considered to initialize the pageNumber, else the existing logic to initialize the pageNumber (either value of pageNumberParameter.initiValue () or else ‘1’ if pageNumberParameter is null.) has been used to initialize it.
The difference in the original code line & modified code is as follows
Original Code: this.pageNumber = (pageNumberParameter null) ? 1 : pageNumberParameter.intValue();
Modified Code: this.pageNumber = (pageNumberParameter null) ? ((defaultPage <= 0) ? 1 : defaultPage) : pageNumberParameter.intValue();
2. The tag library descriptor(TLD) file having TableTag definition has been changed to incorporate the new “defaultPage” attribute definition for the TableTag.
defaultPage false true
Intension for the code changes: In case the records shown are too large to fit in the page, which results in a paginated result, the default page can be set to any page other than the first page, due to this attribute. The records shown by a table using display tag may contain links. If a user traverses the paginated records and reaches on nth page. On this page, he clicks some link contained in one of the records, which takes him/her to some other page. After he wishes to return back to the results page(May be; by clicking some housed “Back” button), he should return to the nth page; the page from where he was redirected to other page and not the first page of the results.
The addition of “defaultPage” attribute helps setting it as the page (among the pages from the paginated result set), where he should be brought back, after he has been redirected from it(by clicking link to some other page).