Re: beanless connection problem

2000-06-05 Thread Mark G. Franz

Ahh good point!  How would you declare client-side vars, other than a
Session object, in JSP?  Can you declare them as you would any VBScript
var?

Mark

>
> Actually, you don't want to make your variables class variables in JSP
> (within the <%!   %>) nor in a servlet unless you don't mind different
> clients accessing the same variables and variable data.
> Instead, declare your variables in the first <% %> block before any if
> /else, or loop statements and your variables will exist in all following <%
> %> blocks.
>
> Eric Dunstan
>
>
> >From: "Mark G. Franz" <[EMAIL PROTECTED]>
> >Reply-To: A mailing list about Java Server Pages specification and
> > reference <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: beanless connection problem
> >Date: Mon, 5 Jun 2000 11:39:48 -0700
> >
> >I would think that the vars would be global only if the If was evaluated
> >TRUE, otherwise the vars would be non-existant.  So yes, either declare
> >them as global or redim them in a Else statement.
> >
> >Mark
> > >
> > > The strings that you have declared X1 and Y1 exist in the scope of the
> >if
> > > statement only.  once out of the if statement these variables no longer
> > > exist.  if you did a println on those variables out of the if clause,
> >you
> > > wouldn't see them.
> > >
> > > A solution is to define those strings as class variables. Read in the
> >values
> > > from the database and assign to those variables.  That way you should be
> > > able to see them in the jsp
> > >
> > > Irfan
> > >
> > > -Original Message-
> > > From: john doucette [mailto:[EMAIL PROTECTED]]
> > > Sent: Saturday, June 03, 2000 3:04 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: beanless connection problem
> > >
> > >
> > > Does anyone see where I'm screwing this up?
> > > I've tried several examples, to no avail.
> > >
> > > Any help would be great!
> > >
> > > Using:
> > > Apache on Solaris 2.6
> > > Oracle 8i(8.1.6)
> > > Jdk 1.2.2
> > > Jrun 2.3.3
> > >
> > > Oracle is on the same machine as the webserver
> > >
> > > //Begin Code
> > > <%@ page import="java.sql.*" %>
> > > <%@ page import="java.io.*"%>
> > > <%@ page import="java.util.*"%>
> > > <%@ page import="java.sql.*"%>
> > > <%@ page import="javax.servlet.*"%>
> > > <%@ page import="javax.servlet.http.*"%>
> > >
> > > <%
> > > try{
> > >
> > > Class.forName("oracle.jdbc.driver.OracleDriver");
> > >
> > > String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
> > > String query = "Select * from STATUS";
> > >
> > > Connection con = DriverManager.getConnection(url, "usernm",
> > > "paswd");
> > > Statement stmt = con.createStatement();
> > >
> > > ResultSet results = stmt.executeQuery(query);
> > >
> > > if (results.next()){
> > > String X1 = results.getString("sor_status");
> > > String Y1 = results.getString("SDefinition");
> > > }
> > > String X1 = "OW";
> > > String Y1 = "dat hurt";
> > > con.close();
> > > }
> > >
> > > catch (ClassNotFoundException e) {
> > > System.err.println("no driver");
> > > }
> > >
> > > catch (SQLException e) {
> > > System.err.println("no db connection");
> > > }
> > >
> > > finally {
> > > try { if (con != null) con.close(); }
> > > catch (SQLException e) {}
> > >
> > > }
> > > %>
> > > 
> > >
> > > 
> > > type:<%=X1%>  Definied:<%=Y1%>
> > > 
> > > 
> > >
> > >
> > >
> > >
> > >  John Doucette  -  818.865.1310
> > >  
> > >  internet development
> > >  sdr technologies
> > >
> > >
> >

Re: beanless connection problem

2000-06-05 Thread Eric Dunstan

Actually, you don't want to make your variables class variables in JSP
(within the <%!   %>) nor in a servlet unless you don't mind different
clients accessing the same variables and variable data.
Instead, declare your variables in the first <% %> block before any if
/else, or loop statements and your variables will exist in all following <%
%> blocks.

Eric Dunstan


>From: "Mark G. Franz" <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: beanless connection problem
>Date: Mon, 5 Jun 2000 11:39:48 -0700
>
>I would think that the vars would be global only if the If was evaluated
>TRUE, otherwise the vars would be non-existant.  So yes, either declare
>them as global or redim them in a Else statement.
>
>Mark
> >
> > The strings that you have declared X1 and Y1 exist in the scope of the
>if
> > statement only.  once out of the if statement these variables no longer
> > exist.  if you did a println on those variables out of the if clause,
>you
> > wouldn't see them.
> >
> > A solution is to define those strings as class variables. Read in the
>values
> > from the database and assign to those variables.  That way you should be
> > able to see them in the jsp
> >
> > Irfan
> >
> > -Original Message-
> > From: john doucette [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, June 03, 2000 3:04 AM
> > To: [EMAIL PROTECTED]
> > Subject: beanless connection problem
> >
> >
> > Does anyone see where I'm screwing this up?
> > I've tried several examples, to no avail.
> >
> > Any help would be great!
> >
> > Using:
> > Apache on Solaris 2.6
> > Oracle 8i(8.1.6)
> > Jdk 1.2.2
> > Jrun 2.3.3
> >
> > Oracle is on the same machine as the webserver
> >
> > //Begin Code
> > <%@ page import="java.sql.*" %>
> > <%@ page import="java.io.*"%>
> > <%@ page import="java.util.*"%>
> > <%@ page import="java.sql.*"%>
> > <%@ page import="javax.servlet.*"%>
> > <%@ page import="javax.servlet.http.*"%>
> >
> > <%
> > try{
> >
> > Class.forName("oracle.jdbc.driver.OracleDriver");
> >
> > String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
> > String query = "Select * from STATUS";
> >
> > Connection con = DriverManager.getConnection(url, "usernm",
> > "paswd");
> > Statement stmt = con.createStatement();
> >
> > ResultSet results = stmt.executeQuery(query);
> >
> > if (results.next()){
> > String X1 = results.getString("sor_status");
> > String Y1 = results.getString("SDefinition");
> > }
> > String X1 = "OW";
> > String Y1 = "dat hurt";
> > con.close();
> > }
> >
> > catch (ClassNotFoundException e) {
> > System.err.println("no driver");
> > }
> >
> > catch (SQLException e) {
> > System.err.println("no db connection");
> > }
> >
> > finally {
> > try { if (con != null) con.close(); }
> > catch (SQLException e) {}
> >
> > }
> > %>
> > 
> >
> > 
> > type:<%=X1%>  Definied:<%=Y1%>
> > 
> > 
> >
> >
> >
> >
> >  John Doucette  -  818.865.1310
> >  
> >  internet development
> >  sdr technologies
> >
> >
>===
> > 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
> >
> >
>===
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> &g

Re: beanless connection problem

2000-06-05 Thread Jonathan Hawkes

What's the error it's throwing?  Is the Oracle driver in your classpath?


Irfan Mohammed wrote:
>
> The strings that you have declared X1 and Y1 exist in the scope of the if
> statement only.  once out of the if statement these variables no longer
> exist.  if you did a println on those variables out of the if clause, you
> wouldn't see them.
>
> A solution is to define those strings as class variables. Read in the values
> from the database and assign to those variables.  That way you should be
> able to see them in the jsp
>
> Irfan
>
> -Original Message-
> From: john doucette [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 03, 2000 3:04 AM
> To: [EMAIL PROTECTED]
> Subject: beanless connection problem
>
> Does anyone see where I'm screwing this up?
> I've tried several examples, to no avail.
>
> Any help would be great!
>
> Using:
> Apache on Solaris 2.6
> Oracle 8i(8.1.6)
> Jdk 1.2.2
> Jrun 2.3.3
>
> Oracle is on the same machine as the webserver
>
> //Begin Code
> <%@ page import="java.sql.*" %>
> <%@ page import="java.io.*"%>
> <%@ page import="java.util.*"%>
> <%@ page import="java.sql.*"%>
> <%@ page import="javax.servlet.*"%>
> <%@ page import="javax.servlet.http.*"%>
>
> <%
> try{
>
> Class.forName("oracle.jdbc.driver.OracleDriver");
>
> String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
> String query = "Select * from STATUS";
>
> Connection con = DriverManager.getConnection(url, "usernm",
> "paswd");
> Statement stmt = con.createStatement();
>
> ResultSet results = stmt.executeQuery(query);
>
> if (results.next()){
> String X1 = results.getString("sor_status");
> String Y1 = results.getString("SDefinition");
> }
> String X1 = "OW";
> String Y1 = "dat hurt";
> con.close();
> }
>
> catch (ClassNotFoundException e) {
> System.err.println("no driver");
> }
>
> catch (SQLException e) {
> System.err.println("no db connection");
> }
>
> finally {
> try { if (con != null) con.close(); }
> catch (SQLException e) {}
>
> }
> %>
> 
>
> 
> type:<%=X1%>  Definied:<%=Y1%>
> 
> 
>
>  John Doucette  -  818.865.1310
>  
>  internet development
>  sdr technologies
>
> ===
> 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
>
> ===
> 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

===
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



Re: beanless connection problem

2000-06-05 Thread Mark G. Franz

I would think that the vars would be global only if the If was evaluated
TRUE, otherwise the vars would be non-existant.  So yes, either declare
them as global or redim them in a Else statement.

Mark
>
> The strings that you have declared X1 and Y1 exist in the scope of the if
> statement only.  once out of the if statement these variables no longer
> exist.  if you did a println on those variables out of the if clause, you
> wouldn't see them.
>
> A solution is to define those strings as class variables. Read in the values
> from the database and assign to those variables.  That way you should be
> able to see them in the jsp
>
> Irfan
>
> -Original Message-
> From: john doucette [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 03, 2000 3:04 AM
> To: [EMAIL PROTECTED]
> Subject: beanless connection problem
>
>
> Does anyone see where I'm screwing this up?
> I've tried several examples, to no avail.
>
> Any help would be great!
>
> Using:
> Apache on Solaris 2.6
> Oracle 8i(8.1.6)
> Jdk 1.2.2
> Jrun 2.3.3
>
> Oracle is on the same machine as the webserver
>
> //Begin Code
> <%@ page import="java.sql.*" %>
> <%@ page import="java.io.*"%>
> <%@ page import="java.util.*"%>
> <%@ page import="java.sql.*"%>
> <%@ page import="javax.servlet.*"%>
> <%@ page import="javax.servlet.http.*"%>
>
> <%
> try{
>
> Class.forName("oracle.jdbc.driver.OracleDriver");
>
> String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
> String query = "Select * from STATUS";
>
> Connection con = DriverManager.getConnection(url, "usernm",
> "paswd");
> Statement stmt = con.createStatement();
>
> ResultSet results = stmt.executeQuery(query);
>
> if (results.next()){
> String X1 = results.getString("sor_status");
> String Y1 = results.getString("SDefinition");
> }
> String X1 = "OW";
> String Y1 = "dat hurt";
> con.close();
> }
>
> catch (ClassNotFoundException e) {
> System.err.println("no driver");
> }
>
> catch (SQLException e) {
> System.err.println("no db connection");
> }
>
> finally {
> try { if (con != null) con.close(); }
> catch (SQLException e) {}
>
> }
> %>
> 
>
> 
> type:<%=X1%>  Definied:<%=Y1%>
> 
> 
>
>
>
>
>  John Doucette  -  818.865.1310
>  
>  internet development
>  sdr technologies
>
> ===
> 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
>
> ===
> 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
>

===
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



Re: beanless connection problem

2000-06-05 Thread Irfan Mohammed

The strings that you have declared X1 and Y1 exist in the scope of the if
statement only.  once out of the if statement these variables no longer
exist.  if you did a println on those variables out of the if clause, you
wouldn't see them.

A solution is to define those strings as class variables. Read in the values
from the database and assign to those variables.  That way you should be
able to see them in the jsp

Irfan

-Original Message-
From: john doucette [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 03, 2000 3:04 AM
To: [EMAIL PROTECTED]
Subject: beanless connection problem


Does anyone see where I'm screwing this up?
I've tried several examples, to no avail.

Any help would be great!

Using:
Apache on Solaris 2.6
Oracle 8i(8.1.6)
Jdk 1.2.2
Jrun 2.3.3

Oracle is on the same machine as the webserver

//Begin Code
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>

<%
try{

Class.forName("oracle.jdbc.driver.OracleDriver");

String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
String query = "Select * from STATUS";

Connection con = DriverManager.getConnection(url, "usernm",
"paswd");
Statement stmt = con.createStatement();

ResultSet results = stmt.executeQuery(query);

if (results.next()){
String X1 = results.getString("sor_status");
String Y1 = results.getString("SDefinition");
}
String X1 = "OW";
String Y1 = "dat hurt";
con.close();
}

catch (ClassNotFoundException e) {
System.err.println("no driver");
}

catch (SQLException e) {
System.err.println("no db connection");
}

finally {
try { if (con != null) con.close(); }
catch (SQLException e) {}

}
%>



type:<%=X1%>  Definied:<%=Y1%>






 John Doucette  -  818.865.1310
 
 internet development
 sdr technologies

===
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

===
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



beanless connection problem

2000-06-03 Thread john doucette

Does anyone see where I'm screwing this up?
I've tried several examples, to no avail.

Any help would be great!

Using:
Apache on Solaris 2.6
Oracle 8i(8.1.6)
Jdk 1.2.2
Jrun 2.3.3

Oracle is on the same machine as the webserver

//Begin Code
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>

<%
try{

Class.forName("oracle.jdbc.driver.OracleDriver");

String url = "jdbc:oracle:[EMAIL PROTECTED]:1521:ora1";
String query = "Select * from STATUS";

Connection con = DriverManager.getConnection(url, "usernm", "paswd");
Statement stmt = con.createStatement();

ResultSet results = stmt.executeQuery(query);

if (results.next()){
String X1 = results.getString("sor_status");
String Y1 = results.getString("SDefinition");
}
String X1 = "OW";
String Y1 = "dat hurt";
con.close();
}

catch (ClassNotFoundException e) {
System.err.println("no driver");
}

catch (SQLException e) {
System.err.println("no db connection");
}

finally {
try { if (con != null) con.close(); }
catch (SQLException e) {}

}
%>



type:<%=X1%>  Definied:<%=Y1%>






 John Doucette  -  818.865.1310
 
 internet development
 sdr technologies

===
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