jQuery in Action, 3rd edition
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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 java.io.*;
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: 3749

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 agree. Here's the link: http://aspose.com/file-tools
subject: Http method post not supported by this url
It's not a secret anymore!