使用struts扩展displaytag 1.保持当前页面和排序条件的问题
我通过扩展标准来实现displaytag。请参阅下面的详细信息。
JSP
display:table name="testList" id="obj" requestURI="testAction.do?pageAction=init" pagesize="${paging_size}" sort="list" class="table" **sort="external"** excludedParams="*" decorator="dyndecorator" export="false" **keepStatus="true"**
display:setProperty name="pagination.pagenumber.param" value="page"
display:setProperty name="pagination.sort.param" value="sort" /
display:setProperty name="pagination.sortdirection.param" value="dir"
display:column property="testNo" title="Test no." **sortable="true"** **sortName="testNo"**
display:column property="testValue" title="Test value" **sortable="true"** **sortName="testValue"**
display:table
PaginatedListImpl
public PaginatedListImpl(HttpServletRequest request) {
sortCriterion = request.getParameter("sort");
sortDirection = "desc".equals(request.getParameter("dir"))? SortOrderEnum.DESCENDING : SortOrderEnum.ASCENDING;
pageSize = DEFAULT_PAGE_SIZE;
String page = request.getParameter("page");
index = page == null? 0 : Integer.parseInt(page) - 1;
}
JAVA
public PaginatedListImpl getTest(
Criteria criList = session.createCriteria(TestDto.class);
criList.setFirstResult(pageDisplay.getFirstRecordIndex());
criList.setMaxResults(pageDisplay.getObjectsPerPage());
pageDisplay.setList(criList.list());
pageDisplay.setTotal((Integer) criTotal.uniqueResult());
return pageDisplay;
}
无论如何,当浏览器呈现结果时,我发现浏览器有问题
当我将鼠标移到 page_no 上时。 它将显示“http://localhost:8080/WebProject/testAction.do?page=2&pageAction=init”
- 。当我将鼠标移到列名称上时,
。它将显示“http://localhost:8080/WebProject/testAction.do?sort=testValue&*dir=asc*pageAction=init”
但是 我需要两者的链接,如下所示 “http://localhost:8080/WebProject/testAction.do?page=2&sort=testValue&dir=asc&pageAction=init”
我在谷歌上搜索了很多次,但我仍然有一个问题。
我该怎么办?有人请帮助我解决问题。
非常感谢..
I am implement displaytag by extend the standard. Please see detail below.
JSP
display:table name="testList" id="obj" requestURI="testAction.do?pageAction=init" pagesize="${paging_size}" sort="list" class="table" **sort="external"** excludedParams="*" decorator="dyndecorator" export="false" **keepStatus="true"**
display:setProperty name="pagination.pagenumber.param" value="page"
display:setProperty name="pagination.sort.param" value="sort" /
display:setProperty name="pagination.sortdirection.param" value="dir"
display:column property="testNo" title="Test no." **sortable="true"** **sortName="testNo"**
display:column property="testValue" title="Test value" **sortable="true"** **sortName="testValue"**
display:table
PaginatedListImpl
public PaginatedListImpl(HttpServletRequest request) {
sortCriterion = request.getParameter("sort");
sortDirection = "desc".equals(request.getParameter("dir"))? SortOrderEnum.DESCENDING : SortOrderEnum.ASCENDING;
pageSize = DEFAULT_PAGE_SIZE;
String page = request.getParameter("page");
index = page == null? 0 : Integer.parseInt(page) - 1;
}
JAVA
public PaginatedListImpl getTest(
Criteria criList = session.createCriteria(TestDto.class);
criList.setFirstResult(pageDisplay.getFirstRecordIndex());
criList.setMaxResults(pageDisplay.getObjectsPerPage());
pageDisplay.setList(criList.list());
pageDisplay.setTotal((Integer) criTotal.uniqueResult());
return pageDisplay;
}
Anyway, I found problem on browser when the browser render the result
when I move the mouse over page_no. It will show "http://localhost:8080/WebProject/testAction.do?page=2&pageAction=init"
when I move the mouse over column name. It will show "http://localhost:8080/WebProject/testAction.do?sort=testValue&*dir=asc*pageAction=init"
but I need the link of both like this
"http://localhost:8080/WebProject/testAction.do?page=2&sort=testValue&dir=asc&pageAction=init"
I search on google many time but I still have a problem.
How can I do? Someone Please help me out of problem.
Thank you a lot..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在下面给你我的示例代码
尝试将 url 放入字符串变量中,并在 html:link 标记中使用字符串变量,如上所示。这可能会解决您的问题。
谢谢
I am giving you my sample code below
Try to put url in string variable and use the string variable in the html:link tag as shown above. This may solve your problem.
Thanks