?
Solved

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

Posted on 2008-06-13
6
Medium Priority
?
447 Views
Last Modified: 2012-08-14
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
Comment
Question by:Blue_Lotus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Manish
ID: 21777664
You need to iterate Vector and pass values to javascipt array.
0
 
LVL 11

Expert Comment

by:Manish
ID: 21777665
0
 

Author Comment

by:Blue_Lotus
ID: 21780759
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
Manish earned 1500 total points
ID: 21790994
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
 

Author Comment

by:Blue_Lotus
ID: 21791156
Yes, I will accept your solution, as my js was messed up.

Thanks.
0
 
LVL 11

Expert Comment

by:Manish
ID: 21791202
:)
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question