Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

doPost method ?  RSS feed

 
Ranch Hand
Posts: 77
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across one mock question.
In JSP below mentioned statement is given


In "MyServlet" Servlet, doGet() and doPost() method is defined.
Then answer is saying that it will call doGet() method.
Explanation is given like this:
doPost is invalid value, so it will interprets it as GET and will call doGet() method.
Is this right?
I had selected answer "Server reports an error"

Thanks
Imran
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this case and doGet method is called.

Amit
 
Imran Vohra
Ranch Hand
Posts: 77
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, anybody clearify that is it vendor-specific or guaranteed by spec.

Thanks
Imran
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt that can be guaranteed by Spec .

This totally depends on the browser in use
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

doPost is invalid value, so it will interprets it as GET and will call doGet() method.
Is this right?



Yes, default mechanism for Form submission if through GET, hence goGet() is called.

In case if we want doPost() to be called then we need to specify it in FORM tag parameters
 
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!