in my project i'm using display tag. The problem comes when the results returned are like e.g. 300 pages. The user needs to jump to page e.g. 200 but he can't. He needs to go slowly there ( 5 pages at a time or so ). I want to add the ability to the user to choose in a drop-down the page he wants to jump to. Is there any property in display-tag or any suggestion?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to use ParamEncoder to get the name (and eventually the value) of displayTag
's parameters, specified in TableTagParameters.html, in your case PARAMETER_PAGE
.
<div>
With Scriptlets
<br/>
<% String pageNumParameter =
new org.displaytag.util.ParamEncoder("id_of_your_displaytag_table").encodeParameterName(org.displaytag.tags.TableTagParameters.PARAMETER_PAGE); %>
[parameter name] = <%= pageNumParameter %>
<br/>
[parameter value]= <%= request.getParameter(pageNumParameter) %>
</div>
<div>
With OGNL
<br/>
<s:set var="pageNumParameter"
value="%{new org.displaytag.util.ParamEncoder('id_of_your_displaytag_table').encodeParameterName(@org.displaytag.tags.TableTagParameters@PARAMETER_PAGE)}" />
[parameter name] = <s:property value="%{#pageNumParameter}"/>
<br/>
[parameter value]= <s:property value="#parameters[#pageNumParameter]"/>
</div>
Then you should be able to craft a request
by passing the dynamic generated parameter for that table, with the value you want (from a SelectBox
, from an Input Text
, from a script etc)