Meaningless Drivel is fun!
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
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.

I agree. Here's the link:
subject: Array List - How Do I?
It's not a secret anymore!