There are two issues with this error message:
1, in the servlet does not invoke the post () method caused by the
2, in the Serlvet jump does not use the outside jump (Response.sendredirect ())
When I was doing my project, I encountered a 1 error and did not call post () in the servlet. When I submit a XMLHttpRequest request to the servlet in the JSP page, The post () is not used in the corresponding servlet, so this error is reported. Solution:
It's OK to call this method in the servlet.
For friends who encounter 2 of errors, you can use the following solution:
Put Request.getrequestdispatcher ("findbyidservlet?id=" +commentpostid). Forward (request, response);
Changed into Response.sendredirect ("findbyidservlet?id=" +commentpostid);
the difference between redirect and forward:
1) redirect Mode
Response.sendredirect ("test.jsp"); The path to the
page is a relative path. Sendredirect can jump to any page, not necessarily limited to this web application, such as:
Response.sendredirect ("http://www.baidu.com"); The browser's address bar changes after the
Jump, which becomes the address of the page you are jumping to.
this way to pass the value out, you can only take parameter in the URL or in the session, can not use Request.setattribute to pass.
2) forward mode
RequestDispatcher dispatcher = Request.getrequestdispatcher ("/a.jsp");
Dispatcher. Forward (request, response); The path to the
page is a relative path. The forward method can only jump to a page in this Web application. The browser address bar does not change after the
jump.
Use this way to jump, you can use three ways to pass values: URL with parameter,session,request.setattribute