如何把java的数组的值给javascript?
<%@ page language="java" contentType="text/html; charset=GBK"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>search result</title>
</head>
<body background= "<%=request.getContextPath()%>/img/top1.jpg">
<%
int i;
String [] toJsp=(String [])request.getAttribute("toJsp");//这里是从action获得的内容
System.out.println(toJsp.length);
%>
<%int count=0;%>
<center>
<form name="form1">
<table align="center">
<tr align="center"><td><input type="button" value="新增" onClick="newadd()"/></td><td><input type="button" value="查看" onClick="check()"/></td><td><input type="button" value="修改" onClick="update()" /></td></tr>
<tr align="center"><td align="center">选择</td><td align="center">题目</td><td align="center">日期</td></tr>
<% for(i = 0;i < toJsp.length;){ %>
<tr align="center"><td><input type="checkbox" value="查看" id="CheckBox<%=i%>"></td><td><%=toJsp[i] %></td><td><%=toJsp[++i]%></td><%i=i+2; %>
<%} %>
</table>
<table align="center">
<tr align="center"><td>内容</td></tr>
<tr align="center"><td><input type="text" id="text1"></td></tr>
<tr align="center"><td><textarea cols="40" rows="10" id="text2"></textarea></td></tr>
</table>
</form>
</center>
</body>
<script type="text/javascript" language="javascript">
function check()
{
var j=0;
while(j<<%=toJsp.length%>)
{<%System.out.println("JAVA001"+count);%>
if(document.getElementById("CheckBox".concat(j)).checked)
{alert(j);alert("count上面="+<%=count%>);
document.getElementById("text1").value = <%=toJsp[count]%>;//就是这边count会变成0
document.getElementById("text2").value = <%=toJsp[count+2]%>;
<%count=0;%>
break;
}
else
{
j = j+3;alert(j);
<%count = count +3; System.out.println("JAVA"+count);%>
alert("count下面="+<%=count%>);
}
}
}
function newadd()
{
document.form1.action = "<%=request.getContextPath()%>/frame/newStudy.jsp";
document.form1.submit();
}
function data(x,y)
{ alert("a");
do