Improve company productivity with a Business Account.Sign Up

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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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