• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

applet to servlet communication

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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: 9099
12
  • Mark post as helpful
  • send pies
  • 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!
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic