aspose file tools*
The moose likes Servlets and the fly likes parameter from jsp to javascript function? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "parameter from jsp to javascript function?" Watch "parameter from jsp to javascript function?" New topic
Author

parameter from jsp to javascript function?

deep venu
Ranch Hand

Joined: Jun 09, 2001
Posts: 56
how can i pass a vector(or array) from jsp to a javascript function?
Julio Lopez
Greenhorn

Joined: Nov 14, 2000
Posts: 28
Just write the javascript array out using a loop. Assuming vector is referenced by v,
<%
int count = 0;
%>
var theArray = new Array(<%= v.size() %> )
<%
for (Enumeration e = v.elements() ; e.hasMoreElements() {
%>
theArray[<%= count %>] = "<%= e.nextElement() %>"
<%
count++;
}
%>
This should work.
Julio Lopez
M-Group Systems
deep venu
Ranch Hand

Joined: Jun 09, 2001
Posts: 56
hi Julio!
thanx alot..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parameter from jsp to javascript function?