This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Http method post not supported by this url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "Http method post not supported by this url" Watch "Http method post not supported by this url" New topic

Http method post not supported by this url

Rahul Bajaj
Ranch Hand

Joined: Sep 21, 2004
Posts: 45
I wrote this html file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


Please enter your username and password
<form action="/Ch05/Login" method="POST">
<p><input type="text" name="username" length="40">
<p><input type="password" name="password" length="40">
<p><input type="submit" value="Submit" >

and the java class which it calls is
package web;
import javax.servlet.*;
import javax.servlet.http.*;

public class Login extends HttpServlet {
public void dopost(HttpServletRequest request, HttpServletResponse response)
{ String username = request.getParameter("username");
try {
PrintWriter writer = response.getWriter();
writer.println("Thank You, "+ username + ". You are now logged into the system.");
}catch (Exception e) {
but when I am deploying it it giving the error as

"HTTP method POST is not supported by this URL" can somebody explain this?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740

dopost should be doPost

[OCA 8 Book] [Blog]
Rahul Bajaj
Ranch Hand

Joined: Sep 21, 2004
Posts: 45
Ok...So do i need to redeploy after changing that/
Abhijeet Thacker

Joined: Jan 15, 2005
Posts: 16
I hope that you have already got the answer of your last question. Just to clarify u need to redeploy your application if you make ANY change in ur classes. This is not the case with jsp files or html files.


Always code as if person who is going to maintain your code is a maniac serial killer and knows where you live
Sanjeev P Kulkarni

Joined: Nov 08, 2009
Posts: 20

try this inside the servlet mapping tags just insert the POST parameter as shown below. It worked for me!

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Http method post not supported by this url
It's not a secret anymore!