Results 1 to 2 of 2
  1. #1
    bhanu122 is offline Member
    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0

    Default The specified HTTP method is not allowed for the requested resource (HTTP method POST

    Java Code:
    import java.io.IOException;
    import java.io.PrintWriter;
    
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    
    public class LoginServlet extends HttpServlet {
    
    	
    	public void doGet(HttpServletRequest request, HttpServletResponse response)
    			throws ServletException, IOException {
    
    		response.setContentType("text/html");
    		PrintWriter out=response.getWriter();
    		String uname=request.getParameter("email");
    		String password=request.getParameter("password");
    		boolean status=VerifyLogin.checkLogin(uname,password);
    		if(status==true){
    			HttpSession session=request.getSession();
    			session.setAttribute("username",uname);
    			out.print("Welcome    " + uname);
    			RequestDispatcher rd=request.getRequestDispatcher("home.jsp");
    			rd.include(request, response);
    		}
    		else{
    			String Error="Please check your EMail and Password";
    			request.setAttribute("Error", Error);
    			
    			RequestDispatcher rd=request.getRequestDispatcher("index.jsp");
    			rd.include(request, response);
    			
    		}
    		out.close();
    	}
    
    }
    Last edited by JosAH; 09-15-2013 at 11:38 AM. Reason: what is the error n how can i solve it??

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default Re: The specified HTTP method is not allowed for the requested resource (HTTP method

    @OP: I added [code] ... [/code] tags around your code; w.r.t. your question: your servlets can only handle GET requests and it received a POST request ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2012, 11:53 AM
  2. Replies: 1
    Last Post: 03-27-2012, 03:52 AM
  3. HTTP Status 404-The requested resource is not available.
    By DeViLHuNTeR in forum Java Servlet
    Replies: 17
    Last Post: 03-11-2011, 02:40 PM
  4. HTTP request method associated with an URL
    By Sonal R N in forum Networking
    Replies: 0
    Last Post: 02-21-2011, 08:35 AM
  5. Replies: 7
    Last Post: 11-11-2009, 08:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •