Search code examples
jspdisplaytag

display tag- customze


I am using display tag in jsp page. I want to customize the display for NO. of pages

I want it to display like this:

 First | Prev 2 of 10  Next | Last

How can I do this? Please help me.

I have used the below code but it display in other way.

<display:setProperty name="basic.msg.empty_list" value="" />
<display:setProperty name="basic.show.header" value=""/>
<display:setProperty name="paging.banner.some_items_found" value=""/>
<display:setProperty name="paging.banner.full" value="Page {5} of {6}: [
                                                 {0} ]" />

<display:setProperty name="paging.banner.first" value="Page {5} of {6}:
                                                 [ {0} ]" />

<display:setProperty name="paging.banner.last" value="Page {5} of {6}:[
                                                 {0} ] " />

The above code displays like 2of 10 [1,2,3,4,5,6,7,8,9,10]


Solution

  • I expect you would want your values for the three paging.banner properties to be

    <a href="{1}">First</a> | <a href="{2}">Prev</a>
    {5} of {6}
    <a href="{3}">Next</a> | <a href="{4}">Last</a>
    

    plus probably some other html to get the formatting right.

    The displaytag documentation lists all the placeholder values you can use in there. {0} is the numbered pages list, which, if I'm understanding you right, is specifically what you don't want.