I have a Bean to query mySQL database. I want to use JSP to display the result set on the web. So, I wrote the following:

<jsp:useBean id="querytest" class="mytestproject.TestTableQueryBean" scope="page"></jsp:useBean>
<%!
ResultSet rs = null ;
ResultSetMetaData rsmd = null ;
int numColumns ;
int i;
%>

<%

rs = querytest.execSQL() ;

if(rs ==null)
out.println("null");
else {

rsmd = rs.getMetaData();
numColumns = rsmd.getColumnCount();

for(int column=1; column <= numColumns; column++){
out.println(rsmd.getColumnName(column));
}
}
%>

I dont know why the resultset is always null? I know the query works.

Thanks,
--subbu