Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 23rd, 2005, 11:52 AM
Registered User
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nirav Joshi Send a message via Yahoo to Nirav Joshi
Default Retrieve Data from Java Bean to JSP page

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:- Nirav.j05@gmail.com,nic_j05@yahoo.co.in

import java.sql.*;
//import java.util.date.*;
import java.io.*;

public class logCheck

                                public logCheck()
                                                        //Default Constructor
                                public void setlog()
                                                           Connection conn=null;

                                                         conn=DriverManager.getConnection("jdbc:oracle:thin :@localhost:1521:nic","hr","hr");

                                                         Statement state = conn.createStatement();
                                                         ResultSet rs = state.executeQuery("select email from employees");

                                                                //This will get the O\P
                                                               // System.err.println("Employees Email ID:-" + rs.getString("email")+"@nirav.com");


                                        ///////////----Catch statement
                                                                catch(IOException ioe)

                                                                catch(SQLException sq)

                                                                catch(ClassNotFoundException cnf)

                                                                catch(Exception e)

                                                                        if(conn != null)
                                                                catch(SQLException sq)



/*public static void main(String nic[])
        logCheck lo= new logCheck();



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="*" />
<title>Email List of Employees</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<b>This is List of Employees Email-----></b>
<i><%=(log.rs.getString("email")); %> </i><br>

N H Joshi
Old August 24th, 2005, 07:45 AM
Authorized User
Join Date: Apr 2005
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Nirav,

From your code it appears that you are trying to retrieve an array of email addresses. In this case, I suggest you access those using a simple scriplet. Something like this..

<%!logcheck log= new logcheck()%>

Now in the code you can simply call the method of this class to print the email addresses.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Jsp,bean iishu JSP Basics 0 November 17th, 2007 11:21 AM
connecting DB with JSP using Java Bean Q4Java Java Databases 1 May 7th, 2007 03:44 AM
Calling bean from jsp page madhavaram123 JSP Basics 6 May 10th, 2006 09:15 PM
Retrieve data page by page riswan BOOK: Professional Crystal Reports for VS.NET 0 April 27th, 2005 10:41 PM
trying to retrieve data from another page Calibus Classic ASP Databases 3 July 17th, 2004 11:51 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.