问题
Here is my Struts code. I would like to know that how can I adjust the position of [last/prev]
[next/last]
links in display tag
<!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>
回答1:
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;
回答2:
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..
来源:https://stackoverflow.com/questions/14464701/how-to-adjust-the-position-of-last-prev-next-last-links-in-struts-2-display