Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp converted to support doPost or doGet?  RSS feed

 
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: 66188
151
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!