wood burning stoves 2.0*
The moose likes JSP and the fly likes How to paging?NumberFormatException: For input string: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to paging?NumberFormatException: For input string: "pageStr"" Watch "How to paging?NumberFormatException: For input string: "pageStr"" New topic
Author

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

Yashnoo lyo
Ranch Hand

Joined: Feb 17, 2003
Posts: 152
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 ]

When I face C# and Java I choose Java.
Yashnoo lyo
Ranch Hand

Joined: Feb 17, 2003
Posts: 152
Up!
Yashnoo lyo
Ranch Hand

Joined: Feb 17, 2003
Posts: 152
Up!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to paging?NumberFormatException: For input string: "pageStr"