Hi,

sDriver, as well as all your other variables, are declared locally within the if block. Once out of that block, they no longer exist. So, when the code in conn_products.jsp executes, which would of course happen after that if block, those variables do not exist.

Add this right before the if block begins:

String sDriver;
String sUser;
String sPass;
String sDSN;

...and of course remove the String type declaration before each variable in the if block, and you should be good to go.

Frank

[EMAIL PROTECTED] wrote:
Could someone point out what's wrong with this setup?
I have a laptop, sometimes going offline and don't want to
change strings each time I'm online or offline. (And don't want to run any
db server on the laptop if I can avoid it.)

Error is here:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 1 in the jsp file: conn_products.jsp
Generated servlet error:
sDriver cannot be resolved




In setup.jsp,

<%
if(request.getServerName().equals("server.com")) {
  String sDriver = "com.mysql.jdbc.Driver";
  String sUser = "user";
  String sPass = "password";
  String sDSN = "jdbc:mysql://localhost:3306/products";
} else if (request.getServerName().equals("localhost")) {
  String sDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
  String sUser = "";
  String sPass = "";
  String sDSN = "jdbc:odbc:products";
}
%>

In conn_products.jsp,

<%
        String MM_products_DRIVER = sDriver ;
        String MM_products_USERNAME = sUser ;
        String MM_products_PASSWORD = sPass ;
        String MM_products_STRING = sDSN ;
%>
And in list.jsp, <%include file="setup.jsp"%>
<%include file="conn_products.jsp"%>
Jhn

__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to