This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes sending javascript array to server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "sending javascript array to server" Watch "sending javascript array to server" New topic
Author

sending javascript array to server

pooja jain
greenhorn
Ranch Hand

Joined: Jan 12, 2005
Posts: 213
hi,

i want to send a javascript array to the server side.

is this the good way of doing this:


and at server side, i can retrive from request.

any inputs?

thanks in advance.
[ September 26, 2007: Message edited by: pooja jain ]

:d
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Please be sure to use UBB code tags when posting code to the forums. Please read this for more information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
pooja jain
greenhorn
Ranch Hand

Joined: Jan 12, 2005
Posts: 213
Originally posted by Bear Bibeault:
Please be sure to use UBB code tags when posting code to the forums. Please read this for more information.


done.

is this the better way guys?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
form elements should not start with a number. It would proabbly be easier to retrieve on the server if you ended up using the same name.

Persoanlly I would do a myArray.join() and put it into one hidden field and split it on the server.

Eric
[ September 26, 2007: Message edited by: Eric Pascarello ]
pooja jain
greenhorn
Ranch Hand

Joined: Jan 12, 2005
Posts: 213
thanks eric.

actually the array contains objects.

so this join() is not working.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Originally posted by pooja jain:
actually the array contains objects.


What kind of objects? You can only send strings to the server (or files, if doing a file upload). What would be the purpose of sending JavaScript objects?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sending javascript array to server
 
Similar Threads
how to set 2d array in hidden field in java script
Calling a JSP from a Javascript
Is it possible to send arraylist from jsp to javascript(same page)
Retrieving strings using getStrings() - DynaValidatorActionForm
appendChild() method is adding element at new line in I.E.