Title: HTTP method POST is not supported by this URL
Tags: servlets
Question: Can someone please tell me why am I getting this error, I have done endless search on web and tried all sorts of suggestions nothing seems to be working.
Error:- HTTP method POST is not supported by this URL
@WebServlet("/LoginProccess")
public class LoginProccess extends HttpServlet {
private static final long serialVersionUID = 1L;
@SuppressWarnings("static-access")
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DbConnection dbConn = null;
Connection conn = null;
CallableStatement proc = null;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
// get the variables entered in the form
String clientID = request.getParameter("cid");
String loginID = request.getParameter("lid");
String password = request.getParameter("pwd");
String instName = request.getParameter("iName");
try{
dbConn = new DbConnection();
conn = dbConn.connection();
proc = conn.prepareCall("{call pa_internal_admin.fu_login(?,?,?,?)}");
proc.setString(1, clientID);
proc.setString(2, loginID);
proc.setString(3, password);
proc.setString(4, instName);
proc.execute();
response.sendRedirect("adminHome.jsp");
proc.close();
} catch (SQLException e) {
out.println("SQLException caught: " + e.getMessage());
} catch (Exception e) {
out.println(e);
} finally {
// Always close the database connection.
try {
if (conn != null)
conn.close();
} catch (SQLException ignored) {
out.println(ignored);


Here is another answer: You are doing some mistake in post method, like you are type public. But, you should must change protected. First of all you must preview the code before to posting your question.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
DbConnection dbConn = null;
Difference between public and protected:
Modifier    | Class | Package | Subclass | World
————————————+———————+—————————+——————————+———————
public      |  ✔    |    ✔    |    ✔     |   ✔
————————————+———————+—————————+——————————+———————
protected   |  ✔    |    ✔    |    ✔     |   ✘
Comment for this answer: After all that struggle I deleted the bloody servlet and created a new one with a different name and it's working.
Comment for this answer: No unfortunately it didn't, I've had it as   protected before but out of frustration I was trying all sorts of silly things. I replaced it back to   protected but still no joy.

Here is another answer: Dont change the visibility modifier
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
Consider to change to
protected void doPost( HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
Comment for this answer: Thanks for your reply, it was a long night and a very frustrated one I was trying all sorts of silly things. I have changed the modifier back to 'protected' it hasn't made any difference.  Any suggestions
Comment for this answer: Please let me know what url are you using probably you are hitting  another url

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:02/19/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<servlets>', 'Title': 'HTTP method POST is not supported by this URL', 'ViewCount': 624, 'id': 21869313, 'user_AboutMe': None, 'user_AccountId': None, 'user_DisplayName': None, 'user_Reputation': None, 'user_Views': None, 'user_id': None}}