【问题标题】:How to adjust the position of [last/prev] [next/last] links of Display Tag in Struts 2如何在Struts 2中调整Display Tag的[last/prev] [next/last]链接的位置
【发布时间】:2013-01-22 17:38:57
【问题描述】:
这是我的 Struts 代码。我想知道如何调整显示标签中[last/prev][next/last]链接的位置
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://displaytag.sf.net" prefix="display" %>
<html>
`enter code here`
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Forbes Top 10 Richest Sports Stars 2009</title>
<link href="css/displaytag.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2>Forbes Top 10 Richest Sports Stars 2009</h2>
<display:table export="true" id="data"
name="sessionScope.HomeForm.richSportsmanList"
requestURI="/homeAction.do" pagesize="3">
<display:column property="place" title="Place" sortable="true" />
<display:column property="name" title="Name" sortable="true" />
<display:column property="age" title="Age" sortable="true" />
<display:column property="annualIncome" title="Income(in m/yr)"
sortable="true" />
</display:table>
<p>Note : List is according to Forbes List 2009</p>
</body>
</html>
【问题讨论】:
标签:
java
jsp
pagination
displaytag
banner
【解决方案1】:
显示标签允许通过display.properties 文件修改其功能。您可以覆盖 paging.banner.placement 属性 top 默认为 <display:setProperty name="paging.banner.placement" value="bottom" /> 要调整横幅的位置(其中 [first/prev] [next/last] 链接),您必须覆盖属性
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>
现在您必须通过更改类pagelinks 或通过添加style 属性来设置横幅的位置来修改div 标签的样式。比如position: absolute; top: 75px; left: 260px; width: 245px; background-color: azure;
【解决方案2】:
Roman 建议了您可以在属性文件中使用的方式。
但有时属性文件解决方案不起作用::
这是解决方案
<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>' />
通过这种方式,您可以使用自定义的分页横幅..