Reputation: 7953
this is how i set values for the html table:
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#f9fae3" align="center" >
<tr class='lightrow'>
<td width="12%" class="title_sub" align="center" >S.No</td>
<td width="12%" class="title_sub" align="left">EmployeeID</td>
<td width="32%" class="title_sub" align="left">Name</td>
<td width="20%" class="title_sub" align="left">Cardnumber</td>
<td width="12%" class="title_sub" align="left">Issued</td>
<td width="12%" class="title_sub" align="left">Status</td>
</tr>
</table>
<%
TempcardViewModel temporaycardDetails=null;
String classname = "darkrow", noresults = "No Records Found ", space = " ";
int sno = 1,htmltablestatus = 0;
String[] colorArray = {"lightrow","darkrow"};
if(tempcardList.size() >0){
htmltablestatus = 1;
int i =0;
for (int iterator=0; iterator < tempcardList.size(); iterator++)
{
if(i == 0) i = 1;
else i = 0;
classname = colorArray[i];
temporaycardDetails=(TempcardViewModel)tempcardList.get(iterator);
%>
<table width='100%' align='center' border='0' cellpadding='0' cellspacing='0'>
<tr class='<%=classname%>'>
<td width="12%" align="center" ><%=sno%></td>
<td width="12%" align="left"><%=temporaycardDetails.getEmpid()%></td>
<td width="32%" align="left"><%=temporaycardDetails.getEmpname()%></td>
<td width="20%" align="left"><%=temporaycardDetails.getTempcardnumber()%></td>
<td width="12%" align="left"><%=temporaycardDetails.getIssuedate()%></td>
<td width="12%" align="left"><%=temporaycardDetails.getTempcardstatus()%></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<% sno++;}//end of for loop
} // end of if loop
%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFF0">
<tr >
<% if(currentPage != 1){
currentPage=currentPage - 1;
%>
<td align="left" ><a href="#" onclick="gotoPage('<%=currentPage%>')">Previous</a></td>
<%}
for(int i=1;i<=noOfPages;i++){
if(currentPage==i){
%>
<td>${i}</td><% } else {%>
<td align="left" ><a href="#" onclick="gotoPage('<%=i%>')"><%=i%></a></td>
<% }%>
<%} %>
<% if(currentPage < noOfPages){
currentPage=currentPage + 1;
%>
<td align="left" ><a href="#" onclick="gotoPage('<%=currentPage%>')">Next</a></td>
<%}%>
</tr>
</table>
i have done this for paging in jsp page. but it gives me the result the problem i face is the number are displayed like follwoing : 1 2 3 4 5 6 Next
(Large space is there between each number)
but i want them to be displayed like 1 2 3 4 5 6 7 next
thanks and regards
Upvotes: 0
Views: 3681
Reputation:
To adjust space between page numbers you have to set width of table or column for the table that displays page numbers.
Upvotes: 1