各位大哥,帮帮我。

dyy123456 2006-04-18 05:50:28
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page language="java" import="java.sql.*,java.util.Date" %>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<html>
<head>
</head>
<body>
<%
Connection conn=null; //数据库连接对象
Statement stmt=null; //SQL语句对象
ResultSet rs=null; //结果集对象
String strCon=""; //数据库连接字符串
String strSQL=""; //SQL语句
int intPageSize=0; //一页显示的记录数
int intRowCount=0; //记录总数
int intPageCount=0; //总页数
int intPage=0; //待显示页码
String strPage="";
int i=0;

//设置一页显示的记录数
intPageSize = 4;
//取得待显示页码
strPage = request.getParameter("page");
if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage = 1;
}
else{//将字符串转换成整型
intPage = java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage = 1;
}
//装载JDBC驱动程序
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//设置数据库连接字符串
//连接数据库
conn = DriverManager.getConnection("jdbc:odbc:life","sa","123456");
//创建一个可以滚动的只读的SQL语句对象
stmt = conn.createStatement();
strSQL = "select houseID from house";
System.out.println("00000!!!");

//执行SQL语句并获取结果集
rs = stmt.executeQuery(strSQL);
System.out.println("18899999!!!");
//获取记录总数
System.out.println("18899440000!!");

rs.last();//??光标在最后一行
System.out.println("18888!!!");
intRowCount = rs.getRow();//获得当前行号
System.out.println("18888!!!");
//记算总页数
intPageCount = (intRowCount+intPageSize-1) / intPageSize;
//调整待显示的页码
if(intPage>intPageCount)
intPage = intPageCount;
%>
<form method="POST" action="3.jsp">
第<%=intPage%>页 共<%=intPageCount%>页

<%if(intPage<intPageCount){%><a

href="3.jsp?page=<%=intPage+1%>">下一页

</a><%}%> <%if(intPage>1){%><a href="3.jsp?page=<%=intPage-1%>">

上一页</a><%}%>
转到第:<input type="text" name="page" size="8"> 页
<span><input class=buttonface type=´submit´ value=´GO´ name=´cndok´></span>
</form>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<th>日期</th>
<th>价格/居室/面积</th>
<th>地址</th>

<th width=´8%´>删除</th>
</tr>
<%
System.out.println("22222222");
if(intPageCount>0){
//将记录指针定位到待显示页的第一条记录上
rs.absolute((intPage-1) * intPageSize + 1);
//显示数据
i = 0;
String rental="";
String room_type="";
String area="";
String address="";
String houseID="";
//java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy年MM月dd日HH时mm分");
//java.util.Date date1 = new java.util.Date();
//java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
while(i<intPageSize && !rs.isAfterLast()){
houseID=rs.getString(houseID);
if(houseID==null)
houseID="";
//String lrsj = rs.getDate(date);
//date1=formatter.format(lrsj);
//date1 = dateformat.parse(lrsj);
rental=rs.getString(rental);
if(houseID==null)
houseID="";

room_type=rs.getString(room_type);
if(room_type==null)
room_type="";
area=rs.getString(area);
if(area==null)
area="";
address=rs.getString(address);
if(address==null)
address="";

%>
<tr>
<td><%=rental%></td>
<td><%=rental%><%=room_type%><%=area%></td>
<td><%=address%></td>
<td width=´8%´ align=´center´>
</tr>
<%
rs.next();
i++;
}
}
%>
</table>


</body>
</html>
<% stmt.close();
conn.close();

%>

这是一个实现分页功能的页面
不知道怎么滴会出现如下错误:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /3.jsp:43

40: System.out.println("00000!!!");
41:
42: //执行SQL语句并获取结果集
43: rs = stmt.executeQuery(strSQL);
44: System.out.println("18899999!!!");
45: //获取记录总数
46: System.out.println("18899440000!!");


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver][SQL Server]对象名 'house' 无效。
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp._3_jsp._jspService(_3_jsp.java:215)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]对象名 'house' 无效。
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
org.apache.jsp._3_jsp._jspService(_3_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.16 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.16

可我怎么检查也找不到错在哪里
...全文
78 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧