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 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Array List - How Do I?" Watch "Array List - How Do I?" New topic
Author

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.

Cheers,
Swamy
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.

cheers
Sonny
 
Consider Paul's rocket mass heater.
 
subject: Array List - How Do I?
 
Similar Threads
Basic Bean Doubt
passing parameters between servlets and applets
help me!!!!!!!!!!
Passing ArrayList from action to action?
MDB related query for defining static variable