Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to paging?NumberFormatException: For input string: "pageStr"

 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends:
I want to paging my guestbook.But the code can't do it and I don't know why.I want to display my guestbook's content in several pages. The code is:
//////////////////main.jsp/////////////////////
while(rs.next()){
title="+"'title'";
%>
<tr><td width=50 align=center>
<%String id=rs.getString("id");%>
<%out.println(rs.getString("name"));%>
</td><td width=130 align=center><a href="view.jsp?id=<%=id%> target=_blank">
<%out.println(rs.getString("title"));%>
</a></td><td ; width=130 align=center>
<%out.println(rs.getString("time"));%>
</td></tr>

<%
}
//rs.close();
%>
</table>
<%
int pageSize=9;
int pageCount=count/pageSize;
String pageStr=request.getParameter("page");
int intPage=Integer.parseInt("pageStr");
if(intPage<1) intPage=1;
if(pageStr==null)intPage=1;
rs.absolute((intPage-1)*pageSize+1);
int i=0;
while(i<pageSize&&!rs.isAfterLast())
{
%>
<td><%=rs.getString(1)%></td>
<td><%=rs.getString(2)%></td>
<%
rs.next();
i++;
rs.close();
}
%>
<h3><font color=green>Current Total <font color=red><%=pageCount%></font>pages</font></h3> <h3>The<%=intPage%>page</h3>
<font color=green size="3">Current total article is:<font color=red size="2"> <%=count%></font></font><%if(intPage<pageCount){%><a href="main.jsp?page=<%=intPage+1%>">next page</a><%}%>
<%if(intPage>pageCount){%><a href="main.jsp?page=<%=intPage-1%>">forward page</a><%}%>
</body>
</html>
When I Run it in JBuilder,Tomcat Says:"java.lang.NumberFormatException: For input string: "pageStr" !!

Who can tell me why? Thank you! :roll:
[ February 18, 2003: Message edited by: lyo lyo ]
[ February 18, 2003: Message edited by: lyo lyo ]
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Up!
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Up!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic