How to pass an array of objects from javascript to Java -


hello im trying pass array of objects javascript java , how can done..?? i've found in posts using hidden input. way? i'm bit confused. please tell me need pass array server? , javascript files , jars need add?

thanks in advance.

you seem want baked-in solution. not sure can provide that, here's i'd do.

indeed use hidden input field in form, value of field valid json string. send form server, , in servlet use json java library parse json string.

here json-lib, gson or jackson do. in case, i'd json-lib seem easiest use.

to generate json string on client-side, either use framework or custom solution. instance, jquery has serialize() function serialize form's fields json object directly, can convert string. other frameworks provide similar functions.

to learn more json, sure read json wikipedia entry , visit official json page (which gives a java implementation of json data-interchange format, though maybe not efficient 1 processing lot of data). make sure generated json valid, can use jsonlint.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -