• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error 405

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I was trying out a program in which I'm taking info from a HTML form and printing it in an email and sending it to a dept...its from Wrox's Professional Java Server Programming book. I'm getting this 405 error where it says that the method GET is not supported by this URL. What does it mean by that ? And I'm using the POST method here in the program.
Any explanations would be welcome.
Thanks.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
From your posting I understand that you have a GET request from the form, but you have doPost in the program to handle the request.
If you have <form action="/jsp/form/process.jsp" method=post> in the HTML form then in your program you should override doPost method. To handle GET request add the following code for the doGet method,
doGet(HttpServletRequest request, HttpServletResponse response){
doPost(HttpServletRequest request, HttpServletResponse response)}
This will redirect your GET request to doPost method.
 
jvarkha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Kartik. I added the doGet method and called the doPost method from there, as you said, and it worked fine. I got this message "Your request has been submitted." But does evey servlet that is using doPost and not doGet have to have the doGet and call doPost from there ? My form action specifies a servlet, just for info.
<FORM ACTION ="http://localhost:8080/servlet/TechSupport" METHOD = "POST">
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
If you have method=post then doPost will handle the request, method=get let doGet to handle the request. If you have <a href="path/servletSample"> then doGet will handle your request.
I hope this answers your question.
 
jvarkha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kartik. The message in quotes in my above reply was to inform the user that the request has been accepted. It was part of the program. And the clarifications were helpful.
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic