This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 202

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: 18121
    
    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
regarding pdf Creation using iText
To compare 2 list and obtain the unmatched values from the list
To compare 2 list and obtain the unmatched values from the list
GET Method Working But POST is not
How to configure Bonecp in java project without breaking connection when more than connection