How to adjust the position of [last/prev] [next/last] links in Struts 2 display tag

限于喜欢 提交于 2019-11-29 15:09:45

The displaytag allows modification of its features through the display.properties file. You can override the property paging.banner.placement that is top by default to the <display:setProperty name="paging.banner.placement" value="bottom" /> To adjust position of the banner (where [first/prev] [next/last] links in) you have to override the property

paging.banner.full=<div class="pagelinks" align="right"><a href={1}>First</a><a href={2}>Prev</a>{0}<a href={3}>Next</a><a href={4}>Last</a></div>

Now you have to modify the style of the div tag via changing the class pagelinks or via adding style attribute to set the position of the banner. For example position: absolute; top: 75px; left: 260px; width: 245px; background-color: azure;

Roman has suggested the way that you can use in properties file. But sometimes properties file solution will not work :: Here is the solution

<display:setProperty name="paging.banner.full" value='<span class="pagelinks"><a href="{1}" onclick="return false"></a> <a href="{2}"><span class="pagenation_LeftAro"/></a>  <a href="{3}"><span class="pagenation_RightAro"/></a><a href="{4}" onclick="return false"></a></span>' />

<display:setProperty name="paging.banner.first" value='<span class="pagelinks"><a href="{1}"  onclick="return false"></a> <a href="{2}" onclick="return false"></a> <a href="{3}"><span class="pagenation_RightAro"/></a><a href="{4}" onclick="return false"></a></span>' />

<display:setProperty name="paging.banner.last" value='<span class="pagelinks"><a href="{1}" onclick="return false"></a> <a href="{2}"><span class="pagenation_LeftAro"/></a> <a href="{3}" onclick="return false"></a><a href="{4}"  onclick="return false"></a></span>' />     

                                      <display:setProperty name="paging.banner.some_items_found" value='<span class="pagelinks"> {2}-{3} of {0}.</span>'/>
                                <display:setProperty name="paging.banner.all_items_found" value='<span class="pagelinks">1-{0} of {0}.</span>' />

In this way you can use cutomized your paging banner..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!