异常捕获为null,为什么啊!mysql+tomcat
<%
int PageSize = 5;//设置每张网页显示5条记录
int showpage = 1;//设置欲显示的页数
int rowcount = 0;//rs的记录数目
int pagecount = 0;//分页后的总页数
int duoyu = 0;
Connection conn = data.getConn();
try{
String sql = "select * from message order by id DESC";
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(sql);
%>
<table width="100%">
<%
if(rs.next()){
rs.last();
rowcount = rs.getRow();
duoyu = rowcount%PageSize;
if(duoyu==0)
{
pagecount = rowcount/PageSize;
}
else
{
pagecount =(rowcount-duoyu)/PageSize;
pagecount++;
}
String topage = request.getParameter("topage");
if(topage==""){topage="1";}
if(topage!=""){
showpage=Integer.parseInt(topage);
if(showpage>pagecount)
{//判断指定页数是否大于总页数,是则设置显示最后一页
showpage=pagecount;
}
else if(showpage<=0)
{
showpage = 1;
}
}
rs.absolute((showpage-1)*PageSize+1);
int i=1,linshi=1;
linshi=showpage;
rs.previous();
while(rs.next()&i<=PageSize){
i++;
String name = rs.getString("name");
String title = rs.getString("title");
String content = rs.getString("content");
java.sql.Date date = rs.getDate("messagedate");
%>
<tr>
<td>留言者:<%=name%></td>
<td>留言时间:<%=date.toString()%></td>
</tr>
<tr>
<td colspan="2">留言标题:<%=title%></td>
</tr>
<tr>
<td colspan="2"><textarea name="tempcontent" cols="60" rows="5"><%=content%></textarea></td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<%
}
linshi=showpage-1;
if(linshi>0)
{%>
<a href="guestbook.jsp?topage=<%=linshi%>">上一页</a>
<%}else{
%>
上一页
<%}   linshi = showpage+1;
if(linshi<=pagecount){
%>
<a href="guestbook.jsp?topage=<%=linshi%>">下一页</a>
<%}else{%>
下一页
<%}
}else{out.println("暂无留言!");}
%>
</table>
<%
}catch(Exception ex){
out.print(ex.getMessage());
}