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

Http Request Type in Servlet

 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If I call a servlet from browser directly, what will be the http request type the service method consider. Will it be doGet()/doPost()

Also, when to use service method directly and when to use doGet()/ doPost() method while writing the
servlet.

It looks like very basic question, please clarify.
 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If "calling from browser directly" in your meaning is typing address in browsers address bar and hitting Enter button, be sure that will result in HTTP GET request = doGet() will invoke.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clarifying that.

Also, please let me know when to overide service method directly than overiding doGet()/doPost().

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please let me know when to overide service method directly than overiding doGet()/doPost()

That's an FAQ: http://faq.javaranch.com/java/ServletsFaq#overriding-service
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic