Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp converted to support doPost or doGet?

 
Sagar J Jambhulkar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As we all know ultimately jsp is converted to a servlet.Now for a servlet one can only support doPost method and not implement doGet method.Advantage of this is servlet cannot be called directly from address bar. I was wondering what happens in case of jsp? Can one explicitly make a jsp page support only doPost method?by default one sees that jsp supports both doGet and doPost.

What is the way of doing it?

Thanks and Regards,
Sagar
"Love work,bless all and you will be blessed by God"
-Sadguru Wamanrao Pai
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could always check the HttpServletRequest.getMethod() - this method indicates whether GET or POST was used for the request. Based on the value do whatever you want - throw an exception, redirect, etc.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65545
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth would you want to do that?
 
Sagar J Jambhulkar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just for knowledge
 
Pay attention! Tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!