By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,034 Members | 819 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,034 IT Pros & Developers. It's quick & easy.

JSP problems

P: 9
Hi I'm having problems displaying information that I am retrieving from a database through an sql query.

My jsp code is as follows:

<%@ page language="java" contentType="text/html" errorPage="errorpage.jsp" import="java.sql.*, java.util.*" %>
<jsp:useBean id="connect" class="myBeans.HostelConnectBean" />
<jsp:setProperty name="connect" property="*" />

<html><head><title>Login</title></head>
<body>
These are the hostels: <%= connect.selectHostel() %>

</body></html>

But the output from this is:

These are the hostels: oracle.jdbc.driver.OracleResultSet@e134e6 instead of displaying the hostels.

Can anyone shed any light on why this is happening?

Thanks
Jan 30 '07 #1
Share this Question
Share on Google+
3 Replies


dmjpro
100+
P: 2,476
I think ur connect.selectHostel() returns the the instance of Resultset interface.
That's why the result is obtained from the toString() method.........
connect.selectHostel().toString() that means the third party implemented class name is oracle.jdbc.driver.OracleResultSet.........
oracle.jdbc.driver.OracleResultSet.toString() method is called...
Such format generally from the toString() method ...XXXX@XXXX
Jan 31 '07 #2

10K+
P: 13,264
I think ur connect.selectHostel() returns the the instance of Resultset interface.
That's why the result is obtained from the toString() method.........
connect.selectHostel().toString() that means the third party implemented class name is oracle.jdbc.driver.OracleResultSet.........
oracle.jdbc.driver.OracleResultSet.toString() method is called...
Such format generally from the toString() method ...XXXX@XXXX

It does. The OP should now extract the relevant data from the resultset for display.
Jan 31 '07 #3

dmjpro
100+
P: 2,476
How the ResultSet istance is used to retrive data.........

<%ResultSet l_result = connect.selectHostel();

while(l_result.next())
{%>
<html_tag><%=l_result.getString("COLUMN_NAME")%> </html_tag>
<%}
%>

I think think hostel name is character basis....
And ur query is somthing like this...
select HOSTEL_NAME from HOSTEL_DATABASE
Jan 31 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.