:: Forum >>
itterating an script
This isn't really a Active Widgets question specifically, but im going to give ask anyway. In my jsp where i have the ActiveWidget table displaying i want to replace the static hardcoded data in the <script> array with a dynamic one. My Data Access layer is returning a list all i have to do is itterate the list and place it into the script array.
But having limited experience with using java scripts i am not sure of the best way to do this. Should i do this in my servlet and pass it onto the JSP, if so how do i call it within the script? or do i keep it the way i have it with a way to itterate the list within the script.
Sorry if that doesn't make any sense i tried.
Script n00b
Monday, February 27, 2006
Here is one way to do it:
<%
while (rs.next()) {
%>
myData.push(["<%=rs.getString("event_id")%>", "<%=rs.getString("g_ip_str")%>"]);
<%
cnt++;
if (cnt == 100 )
break;
}
%>
where myData is
<script>
var myData = [];
</script>
and rs is a RowSet.
Then after this you can do obj.setCellText(myData);
ShepherdOwner
Monday, February 27, 2006
This topic is archived.
Back to support forum
Forum search