I was unable to post my code with the html tags. I edited the tags to make them visible on the page. I hope its legible.
Please suggest where and how do I have to include Javascript function to refresh my chart.
Here is my code:
index.jsp
________
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
html
head
script language = "Javascript" src = "Files/FusionCharts.js"
/script
/head
body
<%
String strDataURL="";
strDataURL = "BulbChart.jsp";
%>
jsp:include page="Files/FusionChartsRenderer.jsp" flush="true"
jsp:param name="chartSWF" value="Charts/FI2_RT_Bulb.swf"
jsp:param name="strURL" value="<%=strDataURL%>"
jsp:param name="strXML" value=""
jsp:param name="chartId" value="Bulb"
jsp:param name="chartWidth" value="150"
jsp:param name="chartHeight" value="150"
jsp:param name="debugMode" value="false"
jsp:param name="registerWithJS" value="true"
/jsp:include
/body
/html
BulbChart.jsp
______________
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ include file="Files/DBConn.jsp" %>
<%
//Database objects initialization
Statement st1, st2 = null;
ResultSet rs1, rs2 = null;
String strQuery = null;
//used to store entire XML Document generated
String strXML = "";
strXML = "";
strXML += "";
strXML += "";
strXML += "";
strXML += "";
strXML += "";
strQuery = "select * from test order";
//Create the statement
st1=oConn.createStatement();
//Execute the query
rs1=st1.executeQuery(strQuery);
String percent=null;
while(rs1.next()) {
percent=rs1.getString("percent");
}
strXML += "" +percent+ "";
strXML += "";
try {
if(rs1 != null){
rs1.close();
rs1=null;
}
}catch(java.sql.SQLException e){
//do something
System.out.println("Could not close the resultset");
}
try {
if(st1 != null) {
st1.close();
st1=null;
}
}catch(java.sql.SQLException e){
System.out.println("Could not close the statement");
}
try {
if(oConn != null) {
oConn.close();
oConn=null;
}
}catch(java.sql.SQLException e){
System.out.println("Could not close the connection");
}
//Set Proper output content-type
response.setContentType("text/xml");
%>
<%=strXML%>