This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Array List - How Do I? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Array List - How Do I?" Watch "Array List - How Do I?" New topic

Array List - How Do I?

Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Ranchers,

I have a requirement where I am having around 12 parameters to be passed to the servlet from a JSP and then to the DB from the Servlet

Now My question is how can i use an ArrayList to do this task of updation?

Like say i want to store all the values in an ArrayList and then update it altogether to DB. Is there any way other than this, that would be better?

If so, where do i get some info on that?

Thanks a lot....

Your help is highly appreciated.

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Hi Ramaswamy,

IMO, If the 12 parameters that you are passing are logically related, the best way would be to have an object with those parameters as instance variables, then you create an object, set those parameters as its properties, and pass it to any method that needs those.
In servlet, JSP environment, you can pass the object by setting it as a request scope attribute. Using an object instead of an Arraylist or Object[] in a case like this would make the code more readable.

Don't get me started about those stupid light bulbs.
subject: Array List - How Do I?