[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 456
  • Last Modified:

*** Urgent - Passing a Vector from Javascript to Java in .jsp

In teh following code how do I pass the Vector from javascript to the java function (.jsp file is as follows) :

function display_onclick(pidStatus) {
var index = 0;
index = pidStatus.get(0);
   
if (index == 0 ) {
         alert("No Products");
}

Now in the javascript part I have this :
Vector pidStatus = (Vector)session.getAttribute("PID_INFO");

<td><input type="button" value="Dsiplay"
            name="ReqSubmit" onClick="display_onclick(pidStatus)"></td>
0
Blue_Lotus
Asked:
Blue_Lotus
  • 4
  • 2
1 Solution
 
ManishLeadCommented:
You need to iterate Vector and pass values to javascipt array.
0
 
Blue_LotusAuthor Commented:
I get an error when I pass in the value, so I am trying to see what the value is by doing this but get a syntax error :

<td>
<%out.println("<tr><td><font color='green'>"+pidStatus.get(0)+"</font></td></tr>");%>
<input type="button" value="Save"
name="ReqSubmit" onClick="save_onclick()"></td>
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
ManishLeadCommented:
there is no such thing as  pidStatus.get(0); in javascript.
How to use array, I have already give you link.
I think you can easity iterate vector and pass the value to javascript array.
Does my link and suggestion doesnt help you to solve the problem?
0
 
Blue_LotusAuthor Commented:
Yes, I will accept your solution, as my js was messed up.

Thanks.
0
 
ManishLeadCommented:
:)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now