HTTP method GET is not supported by this URL



瀏覽器中輸入:http://localhost:8080/項目名/bookquery 后報錯;

錯誤:

Type Status Report

Message HTTP method GET is not supported by this URL

Description The method received in the request-line is known by the origin server but not supported by the target resource.

Web.xml片段:

<servlet>
<servlet-name>bookQuery</servlet-name>
<servlet-class>action.BookQueryServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>bookQuery</servlet-name>
<url-pattern>/bookquery</url-pattern>
</servlet-mapping>
原因:
瀏覽器輸入鏈接請求是doget()方式,而我在servlet里重寫的是dopost方法.
改為上一層的service()方法即可
 
         
         
       


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM