This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes How to populate the values of the vector in jsp to the functions of javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to populate the values of the vector in jsp to the functions of javascript" Watch "How to populate the values of the vector in jsp to the functions of javascript" New topic
Author

How to populate the values of the vector in jsp to the functions of javascript

pankajay
Greenhorn

Joined: Dec 02, 2002
Posts: 2
I have one XML and in jsp i am fatching the values from this now i have the values in a vector(i have done that part).
the problem is that i have to populate the values of this vector in to the functions of javascript.so that i can get the desired result.
i have to pass the values that r in vector to these javascript Functions 0,00.
The aim is to get three combo boxes which r related to each other dynamically
the first combo will have all values from vector level1Data second combo will have all values from vector level2Data and third all values from vector level3Data.
Please tell me if it is possible to pass the values from vector to the function.if yes then How.
Thank u.
Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

hi pankaj...
u can do something of this sort in the jsp to populate the values in the combo box.....

<%
for(int i=0;i<vectorname1.size();i++){
%>
document.form.combobox1.options[document.form.combobox1.length] =
new Option(<%=vectorname1.get(i)%>,<%=vectorname1.get(i)%>, false, true );
<%
}
%>
similarly u can populate the remaining combo boxes ..
an alternative will be to store the values of the vector in a javascript array and populate the combo box as and when reqd....
it would be something similar to the above code in which instead of creating new options for the combo u just add new values to the javascript array.
 
wood burning stoves
 
subject: How to populate the values of the vector in jsp to the functions of javascript