• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Array List - How Do I?

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic