This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert value in a table using session(ArrayList)?
 
Similar Threads
GET Method Working But POST is not
How to configure Bonecp in java project without breaking connection when more than connection
To compare 2 list and obtain the unmatched values from the list
regarding pdf Creation using iText
To compare 2 list and obtain the unmatched values from the list