Displaytag Struts 2转到特定页面 [英] Displaytag struts 2 go to specific page

查看:77
本文介绍了Displaytag Struts 2转到特定页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在使用展示广告代码.当返回的结果例如是300页.用户需要跳转到例如200,但他不能.他需要慢慢去那里(一次5页左右).我想让用户可以在下拉菜单中选择要跳转的页面.展示广告代码中有任何属性或建议吗?

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?

推荐答案

您需要使用 TableTagParameters.html 中指定的参数> ,在您的情况下为PARAMETER_PAGE.

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>

然后,您应该能够通过传递该表的 dynamic 生成的参数来生成request,并带有所需的值(来自SelectBox,来自Input Text,来自脚本等)

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)

这篇关于Displaytag Struts 2转到特定页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆