i am not bale to solve this problem since two weeks

i am trying to access records from mysql database using jsp. inside this jsp program i wrote all my JDBC code. it is working very nicely and displaying records.

now i wrote all the JDBC code in .java and i am accessing that code in jsp file. but this time i am getting only exceptions not records. i am keeping my programs here. please crosscheck once and tell where i am wrong

code

connect.java
-------------------
Code:


package connection;
import java.sql.DriverManager;
import java.sql.Connection;
import java.io.*;
public class connect 
{
Connection conn;
public connect()
{
try{
Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e)
{
System.out.println(e);
}
}
public Connection getConnection()
{
try{
conn=DriverManager.getConnection("mysql:mysql://localhost/hello","root","root");
}catch(Exception e)
{
System.out.println(e);
}
return conn;
}
}
---------------------------------------------------------------
SqlBean.java
---------------
Code:
package sq;
 
import connection.*;
import java.sql.*;
 
public class SqlBean
{
	Connection con=null;
 
	public SqlBean()
	{
	connect c=new connect();
	con=c.getConnection();
	}
 
	// it is used to select the records based on Query
	public ResultSet selection(String query)
	{
	ResultSet rs=null;
	try
	{
		Statement st=con.createStatement();
		rs=st.executeQuery(query);
		//return rs;
	}
	catch(Exception e)
	{
		System.out.println(e);
	}
 
	return rs; 
	}
 
}
--------------------------------------------------

test.jsp
-------------
Code:
<%@ page import="java.sql.*" session="false" %>
<jsp:useBean id="s" class="sq.SqlBean" scope="page" >
<% ResultSet rs=s.selection("select name from how");
 
while ( rs.next() )
{ 
	out.println(rs.getString(1)); 
} 
%>
</jsp:useBean>
and the exceptions what i am getting is

Code:
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
	org.apache.jasper.servlet.JspServletWrapper.servic  e(JspServletWrapper.java:358)
	org.apache.jasper.servlet.JspServlet.serviceJspFil  e(JspServlet.java:301)
	org.apache.jasper.servlet.JspServlet.service(JspSe  rvlet.java:248)
	javax.servlet.http.HttpServlet.service(HttpServlet  .java:856)
 
 
root cause 
 
java.lang.NullPointerException
	org.apache.jsp.test_jsp._jspService(test_jsp.java:  57)
	org.apache.jasper.runtime.HttpJspBase.service(Http  JspBase.java:133)
	javax.servlet.http.HttpServlet.service(HttpServlet  .java:856)
	org.apache.jasper.servlet.JspServletWrapper.servic  e(JspServletWrapper.java:311)
	org.apache.jasper.servlet.JspServlet.serviceJspFil  e(JspServlet.java:301)
	org.apache.jasper.servlet.JspServlet.service(JspSe  rvlet.java:248)
	javax.servlet.http.HttpServlet.service(HttpServlet  .java:856)
 
 
note The full stack trace of the root cause is available in the Tomcat logs.
 

--------------------------------------------------------------------------------
 
Apache Tomcat/5.0.16
waiting for your valuable replys