• Post Reply Bookmark Topic Watch Topic
  • New Topic

convert javascript array into java array  RSS feed

 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that i have a javascript array.I need it to convert into java array..please help me in this regard

also i have a doubt if this can only be done in an applet or is it possible to convert the javascript array into java array in a normal java program

if possible please give some example code so that i can understand them easily

thanks for all your help in advance
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to put the JavaScript array into a hidden form field in the page

Than on the server:

You can reference the value of that element when the form is posted back. You use that string and use the StringTokenizer class to put the values into a java array.

Eric
 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help.But iam developing a standalone application that needs data to be retrived from a web browser.I retrived all the data contents of the html page using the javascript and i have it in an array.Is there any possiblity of converting that javascript array into a java array.

Thanks for this one in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. The JavaScript runs on the client and the Java runs on the server. The communication mechanism between the two is an HTTP request. So, as Eric pointed out, you need to convert the array to something that can be passed as request data, and then reconstruct the array from that data on the server.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!