File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to pass dynamic array content from javascript to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to pass dynamic array content from javascript to jsp" Watch "How to pass dynamic array content from javascript to jsp" New topic
Author

How to pass dynamic array content from javascript to jsp

indu yeturu
Ranch Hand

Joined: Aug 27, 2008
Posts: 123
How the jsp will get dynamic array content from javascript ?

thanks,
indu
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Turn the array into a string, put it into a hidden field, and submit it to the server.

Eric
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Could you be a bit more specific describing the problem? Are you trying to use the contents of a JavaScript array in the *same* JSP you're rendering?
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
I don't know what you're trying do, if you're trying to send an array of contents via ajax to a jsp page. or if you are trying to 'echo' javascript to the page that will give the jsp page some kind of object to work with (which isn't possible, atleast not that I know of).

But if you are processing each element of this array that you want to pass to a jsp page, you could just process each element and send it to the same page over and over again. Like so:



Hope this helps,

Justin">


You down with OOP? Yeah you know me!
indu yeturu
Ranch Hand

Joined: Aug 27, 2008
Posts: 123
I created 4 dynamic arrays for dynamic table html form in javascript.
When I hit the submit button all the dynamic details will be submitted to server.
for that first I need to send all the dynamic array contents jsp.



I have something like this --- 4 types of arrays. What is the process to send these details to some "Submit_details.jsp" sothat from there - Insert into database.

Sending these details from javascript to jsp --- element by element or total dynamic array?
which is the way ?>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You need to convert it to a string and submit it via a hidden element.

You wither loop through and or use join().

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass dynamic array content from javascript to jsp