wood burning stoves*
The moose likes Servlets and the fly likes doget(),doPost(),do Trace(),doOption() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doget(),doPost(),do Trace(),doOption()" Watch "doget(),doPost(),do Trace(),doOption()" New topic
Author

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

prathana balaji
Ranch Hand

Joined: Oct 07, 2007
Posts: 30
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

Joined: Mar 06, 2001
Posts: 13459

Nope, but there is some useful information here.
prathana balaji
Ranch Hand

Joined: Oct 07, 2007
Posts: 30
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

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Mar 06, 2001
Posts: 13459

If you would like more information on the difference between Get and Post, you should see the thread here

Dave
prathana balaji
Ranch Hand

Joined: Oct 07, 2007
Posts: 30
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
Marshal

Joined: Mar 22, 2005
Posts: 41063
    
  43
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).


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doget(),doPost(),do Trace(),doOption()
 
Similar Threads
Math class problem!!
how to display image in jsp from JSON object.
Generic methods
virtual methods
Synchronization Problem whil accessing JDBC Code