• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

applet to servlet communication

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
srinivas k
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for ur reply Mr.Avi,
Even though we use URLConnection it invokes doGet() method only but not doPost() , i have tried this even
 
Avi Abrami
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, srinivas k..

Welcome to JavaRanch! Please adjust your display name to meet the JavaRanch Naming Policy. Unfortunately "k.." is not a valid last name. You can change it here.

Thanks!
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic