Sorry,
I'm forgot the code...
<html>
<title>
Select * from Esipcidade
</title>
<body>
<%@ language="java" import="java.sql.*" %>
<%
Connection connection ;
Statement statement ;
ResultSet rs ;
ResultSetMetaData rsmd ;
Class.forName("oracle.jdbc.driver.OracleDriver") ;
connection =
DriverManager.getConnection("jdbc:oracle:thin:@labserver:1521:orcl", "sip",
"sip");
statement = connection.createStatement() ;
rs = statement.executeQuery("SELECT * FROM ESIPCIDADE") ;
rsmd = rs.getMetaData() ;
%>
<TABLE
WIDTH="100%"
BORDER="+5"
>
<%
for(int i = 1 ; i <= rsmd.getColumnCount() ; i++)
{
rsmd.getColumnLabel(i);
}
while(rs.next())
{
for(int i = 1 ; i <= rsmd.getColumnCount() ; i++)
{
rs.getString(i);
}
}
%>
</table>
</body>
</html>
-----------------------------------------
Walter Priesnitz Filho
Mestrando em Ciencia da Computacao
[EMAIL PROTECTED] | [EMAIL PROTECTED]
http://www.inf.ufsc.br/~walterp
-----------------------------------------
----- Original Message -----
From: "Walter Priesnitz Filho" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 06, 2001 5:36 PM
Subject: Re: Re: JSP + ResultSets
> I found a code in Java Developer's Journal and I'm trying but I'm not vad
> success.
> Could you help-me?
>
> Thanks...
> -----------------------------------------
> Walter Priesnitz Filho
> Mestrando em Ciencia da Computacao
> [EMAIL PROTECTED] | [EMAIL PROTECTED]
> http://www.inf.ufsc.br/~walterp
> -----------------------------------------
> ----- Original Message -----
> From: "Joseph Ottinger" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 06, 2001 4:01 PM
> Subject: Re: JSP + ResultSets
>
>
> > >Hi all,
> > >I need help with an apllication.
> > >I need make a query in an Oracle Table and put the result in a html
> table.
> > >How can I pass the resultset from Oracle to JSP?
> > >Does anybody help-me???
> >
> > You don't "pass the resultset from Oracle to JSP."
> >
> > I don't know what kind of architecture you're using, but here's a
simple,
> > incomplete, and quite flawed example:
> >
> > <!-- ... assume full setup has been done, to the point where the
> Connection
> > is in a variable called "conn" -->
> > <table>
> > <%
> > PreparedStatement ps=conn.createPreparedStatement("select * from
> my_table");
> > ResultSet rs=ps.executeQuery();
> > while(rs.next())
> > {
> > out.println("<tr><td>"+rs.getString(1)+"</tr></td>");
> > }
> > rs.close();
> > %>
> > </table>
> >
> > Voila! Table from a resultset! Lacks all exception handling and error
> > trapping, uses massive scriptlets, as maintainable as... um... well,
it's
> > not really maintainable.
> >
> > A better route would be to use EJBs or a MVC approach (where a front end
> > servlet is responsible for constructing the resultset).
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > 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
> >
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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