This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

doget(),doPost(),do Trace(),doOption()

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Please can anyone help me in understanding these methods of servlets,by giving any sample coding for all the methods.

Please..

Thanks in advance
Regards,
Prathana
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, but there is some useful information here.
 
prathana balaji
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thanks for the information,it is totally theoretical,I can very well understand the concepts,but I don't how to implement it.So I just want some example code/programs to under the implementation of the servlet methods.

Thanks & regards,
Prathana
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doGet()

doPost()

doTrace()


The final example is left to the reader.

Seriously thought, each gets called and responds with information to the client. In theory they could all do the same thing, but in practice only Get and Post are really used, and what they return is a matter of best practice rather than anything else.

Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you would like more information on the difference between Get and Post, you should see the thread here

Dave
 
prathana balaji
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi dave,

I tried the code which you have send for doTrace()
I am getting the below error in browser,can you please help me

HTTP Status 405 - HTTP method GET is not supported by this URL

--------------------------------------------------------------------------------

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).


--------------------------------------------------------------------------------

Sun Java System Application Server Platform Edition 9.0_01

Regards,
Prathana
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried the code which you have send for doTrace()
I am getting the below error in browser,can you please help me

HTTP Status 405 - HTTP method GET is not supported by this URL


If the servlet only implements doTrace then it can only be accessed using the HTTP TRACE method. That means you can't use an HTML link (which uses GET), and HTML form (which uses GET or POST) or type the address into the browser manually (which would use GET). You'll need to use an HTTP client library like Apache Commons HttpClient, or write some JavaScript code using XmlHttpRequest (which can generate all HTTP methods).
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!