This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes HTTP method GET is not supported error when the JSP is making POST request to the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP method GET is not supported error when the JSP is making POST request to the servlet" Watch "HTTP method GET is not supported error when the JSP is making POST request to the servlet" New topic
Author

HTTP method GET is not supported error when the JSP is making POST request to the servlet

manasee patel
Greenhorn

Joined: Nov 17, 2010
Posts: 6
I have this JSP. The same JSP is to ask for data and display all the previously entered data. This JSP is making a POST request to servlet which put the data coming from parameters of each request in the ServletContext. The first time when I enter data and hit Submit button it works. But for second request there is "HTTP Status 405 - HTTP method GET is not supported by this URL" error. When I override doGet() or redirect the response instead of doing forward, it works.

In JSP the method is POST. i.e every time JSP is making POST request to the servlet. So why there is that 405 error?

The servlet Sample.java:

-------------------------
ChatAdmin.jsp Code Fragment

-------------------------------------------------
web.xml:

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12683
    
    5


If that is really the way your web.xml reads, I am surprised you get anything. ALL classes used in servlets should be in a package.

Bill

Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP method GET is not supported error when the JSP is making POST request to the servlet
 
Similar Threads
doPost query
multiple HTML popup windows
Html Input to oracle through servlet and JSP output
Servlet Displays Old DB Entries
PrintWriter's println not working properly for me