I tried to send a value to servlet, in the servlet the request parameter will be the value from the servlet and insert that value in a table.
But data is not getting inserted into table,if i call the servlet from my applet.I don't know where i'm going wrong.
What happens if you call that servlet directly from a browser? Does it work then?
Also, I would seriously suggest you redesign your servlet. It has instance fields that are set by requests. This makes it highly thread unsafe. Two concurrent requests (which is very common!) will cause problems. If "value" is your only instance field have doGetOrdoPost return the value instead of storing it in an instance field:
I should move this thread, but I'm not sure yet if it's an applet problem or a servlet problem. Hence my first question.
It appears that in the applet you use the POST method to send the request. But you don't send any parameters; appending parameters to the URL is what you do if you're using the GET method. You could have done some debugging in the servlet to see if the parameter was being passed; I think it isn't.
You should decide in your servlet if you want to use POST or GET, and just handle one of them. Then you should write your applet to use whichever method you designed your servlet to use.
And in the applet you should URL-encode the parameter in case it includes characters other than letters and digits. (And why do you append an empty string to the URL? That does nothing but add confusion for the reader.)
Plenty of bad practices in the servlet too. I would at least commit the transaction and close the connection, but that's just the start.
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop