Hi All, how can i invoke with a servlet using an applet so that only the doPost() method is only called (ofcourse besides other methods like init(), destroy() method are by default invoked) i:e i do not want doGet() method to be invoked when i call the servlet using an applet, i want the doPost() method to be invoked. :roll:
Hi Srinivas, As far as I know, when you use the "java.net.URLConnection" class to connect to a servlet from another java class (like and applet, for example), you are invoking that servlet's "doPost()" method only (and _not_ its "doGet()" method). In case you haven't read it, this article contains more details: http://www.javaworld.com/javaworld/jw-03-2001/jw-0323-traps.html Hope this helps. Good Luck, Avi.
posted 17 years ago
Thanks for ur reply Mr.Avi, Even though we use URLConnection it invokes doGet() method only but not doPost() , i have tried this even
Then remove the query part of your URL -- this is the part after the question-mark, example: http://www.some_site.org?id=321 The "?id=321" part causes the "doGet()" method of your servlet to be invoked. Remove that, and your servlet's "doPost()" method _should_ be invoked. Hope this helps. Good Luck, Avi.