public class Pager {
private int currentPage;
private int pageSize=3;
private int totalSize;
private int totalPage; private boolean hasFirst;
private boolean hasPrevious;
private boolean hasNext;
private boolean hasLast;

//构造函数
public Pager(int currentPage,int totalPage)
{
this.currentPage=currentPage;
this.totalPage=totalPage;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalSize() {
return totalSize;
}
public void setTotalSize(int totalSize) {
this.totalSize = totalSize;
}
public int getTotalPage() {
//计算总页数
totalPage=totalSize/pageSize;
if(totalSize%pageSize!=0)
{
totalPage++;
}
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public boolean isHasFirst() {
//判断当前页是否是第一页
if(this.currentPage==1)
return false;
return true;
}
public void setHasFirst(boolean hasFirst) {
this.hasFirst = hasFirst;
}
public boolean isHasPrevious() {
if(this.isHasFirst())
return true;
return false;
}
public void setHasPrevious(boolean hasPrevious) {
this.hasPrevious = hasPrevious;
}
public boolean isHasNext() {
//判断是否有下一页
if(this.isHasLast())
return true;
return false;
}
public void setHasNext(boolean hasNext) {
this.hasNext = hasNext;
}
public boolean isHasLast() {
//判断当前页是否等于总页数
if(currentPage==getTotalPage())
return false;
return true;
}
public void setHasLast(boolean hasLast) {
this.hasLast = hasLast;
}
}

<ww:if test="#pager.hasFirst">
<a href="browseBook.action?currentPage=1">首页</a>
</ww:if>
<ww:if test="#pager.hasPrevious">
<a
href="browseBook.action?currentPage=<ww:property value="#pager.currentPage-1" />">上一页</a>
</ww:if>
<ww:if test="#pager.hasNext">
<a
href="browseBook.action?currentPage=<ww:property value="#pager.currentPage+1" />">下一页</a>
</ww:if>
<ww:if test="#pager.hasLast">
<a
href="browseBook.action?currentPage=<ww:property value="#pager.totalPage"/>">尾页</a>
</ww:if>
<br />
当前第
<ww:property value="#pager.currentPage" />
页,总共
<ww:property value="#pager.totalPage" />

</body>
</html>
在jsp页面总是显示  首页    上一页   下一页    尾页
当前页 第-1页   ,总共0页。
尤其是我将鼠标移动到尾页时,显示currentpage=0,我不知道怎么回事,麻烦各位指点。