to get connection you can write a bean, which does it the sample for it i'll give it connects to a datasource and you use Jrun 3.1 or 4 for that.
-----------------------------
package com.sysarris.model;
import java.sql.*;
import java.util.*;
import java.io.*;
import javax.sql.*;
import javax.naming.*;
public class SysConnector
{
private Connection conn;
private String msgconn;
public SysConnector()
{
}
public Connection getConnection()
{
try
{
if(conn!=null)
{
if(conn.isClosed())
{
InitialContext ctx = new InitialContext();
// Look up data source in InitialContext.
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ldsdatasrc"

;
conn = ds.getConnection();
}
}
else
{
InitialContext ctx = new InitialContext();
// Look up data source in InitialContext.
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ldsdatasrc"

;
conn = ds.getConnection();
}
}catch(Exception e)
{
}
return conn;
}
}
------------------------------
use this for connection and than u can use query to get the result set from bean and than use it in the JSp page.