一个简单的问题。。。 这个问题不简单呀?javascript在客户端,你定义的类在服务器端,怎么调用呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个是不太容易阿。我在程序当中,有这种情况,我想从数据库中选出相关的数据放入到数组中,然后在javascript中使用这个数组,我是这样作的:1。在jsp中选出需要的数据,并放入一个String数组中;2。在javascript中,将String数组存放在一个javascript中的数组中;3。这样就可以在javascript调用那个数组了。下面是源码,希望对你有帮助,如果有不清楚,可给我邮件:[email protected]<jsp:useBean id = "mocata" class = "com.keysoft.smsbean.QueryMobileCata" scope = "page" /><% String thisurl = ""; int rcdNum = 0; ResultSet cata = null; cata = mocata.getAllMobileCata(); rcdNum = mocata.getRecordCount();%><script language="Javascript"> menu1 = new Array(); var tmp,tmp1; var temp; temp = 1; </script> <% int temp; temp = 0; while(cata.next()) { temp = temp + 1; %><script language="Javascript"> menu1[<%=temp%>] = new Array(5); tmp = "<%=cata.getString("id")%>"; if(tmp != "null" && tmp != "") { menu1[<%=temp%>][1] = tmp; tmp2 = "<%=cata.getString("parentid")%>"; if(tmp2 != "null" && tmp2 != "") { menu1[<%=temp%>][2] = tmp2; } else { menu1[<%=temp%>][2] = "0"; } tmp2 = "<%=cata.getString("name")%>"; if(tmp2 != "null" && tmp2 != "") { menu1[<%=temp%>][3] = tmp2; } else { menu1[<%=temp%>][3] = ""; } tmp2 = "<%=cata.getString("filename")%>"; if(tmp2 != "null" && tmp != "") { tmp2 = tmp2 + "?cid=" + menu1[<%=temp%>][1]; menu1[<%=temp%>][4] = tmp2; } else { menu1[<%=temp%>][4] = ""; } menu1[<%=temp%>][5] = "smsmain"; } </script><% }%> JavaMail的AuthenticationFailedException异常 jsp如何调用action后打开子画面(struts2) 如何取得连接池中,已用的连接数,空闲的连接数,最大连接数 小菜鸟竭诚请教JSP页面的显示控制问题! ....请进来看看,大家有没有遇见过?? log4j配置每天生成一个log文件?? 页面include后如何能保持bean实例? 如何实现模糊组合查询???? 利用session监听程序统计在线人数的一点心得. 请问:为什么我一编辑就出错,这个class文件到底应该放在哪一级目录上? 使用java进行后台服务程序的开发 有什么办法能控制软件的版本
1。在jsp中选出需要的数据,并放入一个String数组中;
2。在javascript中,将String数组存放在一个javascript中的数组中;
3。这样就可以在javascript调用那个数组了。
下面是源码,希望对你有帮助,如果有不清楚,可给我邮件:[email protected]<jsp:useBean id = "mocata" class = "com.keysoft.smsbean.QueryMobileCata" scope = "page" /><% String thisurl = "";
int rcdNum = 0; ResultSet cata = null; cata = mocata.getAllMobileCata();
rcdNum = mocata.getRecordCount();
%><script language="Javascript">
menu1 = new Array();
var tmp,tmp1;
var temp; temp = 1;
</script>
<%
int temp;
temp = 0;
while(cata.next())
{
temp = temp + 1;
%>
<script language="Javascript"> menu1[<%=temp%>] = new Array(5);
tmp = "<%=cata.getString("id")%>";
if(tmp != "null" && tmp != "")
{
menu1[<%=temp%>][1] = tmp;
tmp2 = "<%=cata.getString("parentid")%>"; if(tmp2 != "null" && tmp2 != "")
{
menu1[<%=temp%>][2] = tmp2;
}
else
{
menu1[<%=temp%>][2] = "0";
} tmp2 = "<%=cata.getString("name")%>";
if(tmp2 != "null" && tmp2 != "")
{
menu1[<%=temp%>][3] = tmp2;
}
else
{
menu1[<%=temp%>][3] = "";
}
tmp2 = "<%=cata.getString("filename")%>";
if(tmp2 != "null" && tmp != "")
{
tmp2 = tmp2 + "?cid=" + menu1[<%=temp%>][1];
menu1[<%=temp%>][4] = tmp2;
}
else
{
menu1[<%=temp%>][4] = "";
}
menu1[<%=temp%>][5] = "smsmain"; } </script><%
}
%>