• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rd Dari
Ranch Hand
Posts: 212
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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!!!
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic