dcsimg
I am having a problem with generating a string in JSP using Server Side JavaScript
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Matthew_David
Posted On:   Monday, January 20, 2003 02:12 PM

Hello, I am trying to generate a string from a database and I can not get it to work. I have the connection to the database working fine, the table and fields are working but the JavaScript I am using to generate the string may be wrong. Any help would be great. Here is the code: <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> < %@ include file="../Connections/getChart.jsp" %> < % Driver DrivergetData = (Driver)Class.forName(MM_getChart_DRIVER).newInstance(); Connection ConngetData = DriverManager.getConnection(MM_getChart_S   More>>

Hello,

I am trying to generate a string from a database and I can not get it to work.


I have the connection to the database working fine, the table and fields are
working but the JavaScript I am using to generate the string may be wrong.


Any help would be great. Here is the code:


<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<
%@ include file="../Connections/getChart.jsp" %>

<
%

Driver DrivergetData = (Driver)Class.forName(MM_getChart_DRIVER).newInstance();

Connection ConngetData = DriverManager.getConnection(MM_getChart_STRING,MM_getChart_USERNAME,MM_getChart_PASSWORD);

PreparedStatement StatementgetData = ConngetData.prepareStatement("SELECT
* FROM flashBarChart");

ResultSet getData = StatementgetData.executeQuery();

boolean getData_isEmpty = !getData.next();

boolean getData_hasData = !getData_isEmpty;

Object getData_data;

int getData_numRows = 0;

%>

<
%

function WA_DFC1_GenerateChartString() {

var retVal = "type=" + escape("bar");


//Static Bound Variables

//Bound Variables

dc = "";

dv = "";

//Bound Values

while (!getData.EOF) {

if (dc != "") dc += "|";

dc += escape(getData.Fields.Item("Color").Value);

if (dv != "") dv += "|";

dv += escape(getData.Fields.Item("Value").Value);

getData.MoveNext();

}

if (getData.CursorType > 0) {

if (!getData.BOF) getData.MoveFirst();

} else {

getData.Requery();

}

//Add Bound Strings

retVal += "&" + "dc=" + dc;

retVal += "&" + "dv=" + dv;

//Other Static Variables

retVal += "&depth=10&gap=5&b=off&g=on&gc=CCCCCC&gs=Auto&gmaj=3&gmin=3&y=on&yf=Arial&ys=12&yo=horizontal&yc=000000&x=on&xf=Arial&xs=12&xo=vertical&xc=000000&vd=rollover&vf=Arial&vc=000000&vp=onbar&vs=12&dataDone=1";


return retVal;

}

var WA_DFC1_DataString = WA_DFC1_GenerateChartString();

%>

<
html>

<
head>

<
title>Untitled Document

<
/head>

<
body>

<
%=WA_DFC1_DataString%>

<
/body>

<
/html>

<
%

getData.close();

StatementgetData.close();

ConngetData.close();

%>

   <<Less
About | Sitemap | Contact