aspose file tools*
The moose likes Servlets and the fly likes How to insert value in a table using session(ArrayList)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to insert value in a table using session(ArrayList)?" Watch "How to insert value in a table using session(ArrayList)?" New topic
Author

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

Rd Dari
Ranch Hand

Joined: Feb 22, 2010
Posts: 206

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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
 
subject: How to insert value in a table using session(ArrayList)?