我正在将 google-api 用于折线图。在 jsp 页面中,我以这种方式实现:但无法获取值,我的查询运行良好但无法动态运行,实际上请点击此链接:输入链接描述在这里
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
<%
Connection con = null;
Statement stmt = null;
con = LoginDB.createConnection();
stmt = con.createStatement();
String sql="select Day(date) as regDate,count(name) as NoOfReg from info where DATE(date) > DATE_SUB(curdate(),interval 365 day)group by regDate order by date asc;";
ResultSet rs = stmt.executeQuery(sql);
%>
<% while(rs.next()){ %>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['regDate', 'Registration'],
['<%= rs.getString(1)%>', <%= rs.getString(2)%>]
]);
var options = {
title: 'No of Registration per Day'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
任何输入将不胜感激。