File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Javascript accessing Arraylist of the form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Javascript accessing Arraylist of the form" Watch "Javascript accessing Arraylist of the form" New topic

Javascript accessing Arraylist of the form

Sachin Ag

Joined: Sep 15, 2010
Posts: 5

I have an arraylist of objects and am using logic:iterate on the jsp page to display the table contents dynamically. My object has 3 fields, one checked variable for checkbox, one description and one value. What i want is that when submit button is clicked, then in javascript i need to do some validations. In javascript i want to get all the checkbox selected in the table and the corresponding description and value of that row.

I didn't find any way to access java arraylist in Javascript. Somewhere i read convert arraylist to javascript array but didn't find any concrete example.

Please do provide me some example of this scenario.
Some code snippets needed.
Thanks a lot.

Joe Ess

Joined: Oct 29, 2001
Posts: 9188

This post is awful similar to your other post on the subject. You can't access the server-side array list from the client-side javascript. You'll have to print the array list values out and manipulate them with JavaScript, which seems pretty much what you are doing in your other post.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Javascript accessing Arraylist of the form
jQuery in Action, 3rd edition