Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
prathana balaji
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
 
David O'Meara
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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • 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