Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 23rd, 2005, 11:52 AM
Registered User
Join Date: Aug 2005
Location: Ahmedabad, Gujrat, India.
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
Reply With Quote
  #2 (permalink)  
Old August 24th, 2005, 07:45 AM
Authorized User
Join Date: Apr 2005
Location: , , India.
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.



Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 06:14 AM.

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