Eoin,
I'm new to this so there's probably a better way of doing this, but it works
for me...
<HTML>
<HEAD>
</HEAD>
<BODY bgcolor="#00CCCC" text="#ffffff">
<CENTER>
<table cellspacing="2" cellpadding="2" border="0" width="90%">
<%
String connectString="jdbc:oracle:thin:@host:1521:SID";
String dbUser="user";
String dbPass="pass";
String sqlString;
// A single connection to the database
Connection OracleConnection = null;
String customer = "";
String location = "";
Statement S = null;
ResultSet R = null;
try
{
// Load the JDBC driver
Class.forName("oracle.jdbc.driver.OracleDriver");
// Create a new connection to the database
OracleConnection = DriverManager.getConnection(connectString, dbUser,
dbPass);
//Create Resultset
sqlString="select customer,location from customer_settings";
S = OracleConnection.createStatement();
R = S.executeQuery(sqlString);
//Loop through resultset
R.next();
while (R.getRow() != 0) {
customer = R.getString(2);
location = R.getString(3);
out.println("<tr>");
out.println("<td bgcolor=\"#cccccc\">" + customer + "</td>");
out.println("<td bgcolor=\"#cccccc\">" + location + "</td>");
out.println("<td><a
href='/Update.jsp?customer="+customer+"&location="+location
+"'>Update</a></td>");
out.println("</tr>");
R.next();
}
out.println("</table>");
//Close Resultset, Statement and OracleConnection
R.close();
S.close();
OracleConnection.close();
}
catch(Exception e) {
e.printStackTrace(new PrintWriter(out));
}
%>
Hope this helps.
Malc.
-----Original Message-----
From: Eoin Shalloo [mailto:[EMAIL PROTECTED]]
Sent: 02 August 2000 09:31
To: [EMAIL PROTECTED]
Subject: Dynamic population of list box
Hi,
I need to be able to retrieve a list of employees' names from Oracle and
populate a list box with that data.
Retrieving the names and displaying them on a webpage as plain text is fine
. I am just not clear how to dynamically populate a list box so that the
user may select one and then I can use the selected value to retrieve that
employee's information.
Can anyone point me in the right direction?
Regards,
Eoin.
~
"Ní hé lá na gaoithe lá na scolb"
T: +353 1 6710692
F: +353 1 6710863
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
***************************************************************
The contents of this Email and any files transmitted with it
are confidential and intended solely for the use of the
individual or entity to whom it is addressed. The views stated
herein do not necessarily represent the view of the company.
If you are not the intended recipient of this Email you may not
copy, forward, disclose or otherwise use it or any part of it
in any form whatsoever. If you have received this mail in
error please Email the sender.
***************************************************************
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets