• 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

How to insert value in a table using session(ArrayList)?

 
Ranch Hand
Posts: 214
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

This is my servlet and I want to add values in a table using this servlet but I am facing a problem how to set an ArrayList object in pst.setString ???

Please suggest me and Thank you in advanced

code is here


in ar1 values are accorate and ar2 also but I am anable to set these values in pst.setString ....so please clear it...


Thanks once again!!!
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rd Dari wrote:This is my servlet and I want to add values in a table using this servlet but I am facing a problem how to set an ArrayList object in pst.setString ???



Well, you wouldn't. If "pst" is a PreparedStatement then its setString() method requires a String as the second parameter. So asking how to pass an ArrayList there doesn't make any sense. You should review your requirements to find out where that String is supposed to come from.

And just another piece of advice: if you are still working on basic Java or JDBC programming, then a servlet is going to be a very inconvenient test environment. Do your training and practicing in a plain old Java application. Then after you have working code, take that code and insert it into your servlet.
 
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic