Hi Gurus
I have created the Bean that is Retirve Data from the Oracle DB Now I wann add new Functionality that I wann use that bean in to the JSp page and show the Data Fetched by that Java Bean page on the JSP page I try a lot But give me an Erro
So Here I m post my Java Bean and JSP page code plz help me to solve this Problem
THanks in Advance
:)
Java Bean is As Follow
//------This Program is Showing that how to connect with the Oracle Database using thin driver of ORacle Thin and Fetch the Row from that connection
//------Developed By --Nirav Joshi
//------ (D.I.T,B.E IT)
//------ (Oracle 9i DBA)
//---- Email:- [email protected],[email protected]
import java.sql.*;
//import java.util.date.*;
import java.io.*;
public class logCheck
{
public logCheck()
{
//Default Constructor
}
public void setlog()
{
Connection conn=null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin :@localhost:1521:nic","hr","hr");
Statement state = conn.createStatement();
ResultSet rs = state.executeQuery("select email from employees");
while(rs.next())
{
//This will get the O\P
// System.err.println("Employees Email ID:-" + rs.getString("email")+"@nirav.com");
}
//rs.close();
System.in.read();
}
///////////----Catch statement
catch(IOException ioe)
{
System.err.println(ioe.getMessage());
}
catch(SQLException sq)
{
System.err.println(sq.getMessage());
}
catch(ClassNotFoundException cnf)
{
System.err.println(cnf.getMessage());
}
catch(Exception e)
{
System.err.println(e.getMessage());
}
finally
{
try
{
if(conn != null)
{
conn.close();
}
}
catch(SQLException sq)
{
System.err.println(sq.getMessage());
}
}
}
/*public static void main(String nic[])
{
logCheck lo= new logCheck();
lo.setlog();
}
*/
}
Now jSP page as Follow:-
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="log" class="logCheck" scope="page" />
<jsp:setProperty name="log" property="*" />
<html>
<head>
<title>Email List of Employees</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<b>This is List of Employees Email-----></b>
<i><%=(log.rs.getString("email")); %> </i><br>
</body>
</html>
N H Joshi