﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-若愚若怯-随笔分类-错误整理</title><link>http://www.blogjava.net/iwwenbo/category/54153.html</link><description /><language>zh-cn</language><lastBuildDate>Mon, 10 Feb 2014 05:45:29 GMT</lastBuildDate><pubDate>Mon, 10 Feb 2014 05:45:29 GMT</pubDate><ttl>60</ttl><item><title>HTTP Status 405  ------------HTTP method GET is not supported by this URL</title><link>http://www.blogjava.net/iwwenbo/archive/2014/02/10/409660.html</link><dc:creator>若愚若怯</dc:creator><author>若愚若怯</author><pubDate>Mon, 10 Feb 2014 05:32:00 GMT</pubDate><guid>http://www.blogjava.net/iwwenbo/archive/2014/02/10/409660.html</guid><wfw:comment>http://www.blogjava.net/iwwenbo/comments/409660.html</wfw:comment><comments>http://www.blogjava.net/iwwenbo/archive/2014/02/10/409660.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/iwwenbo/comments/commentRss/409660.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/iwwenbo/services/trackbacks/409660.html</trackback:ping><description><![CDATA[Type: &nbsp; &nbsp; &nbsp; &nbsp;<span style="font-size: 10pt;"> Status Report</span><br />Messsage: &nbsp;<span style="font-family: Tahoma, Arial, sans-serif; font-size: 10pt; line-height: normal;">HTTP method GET is not supported by this URL</span><span style="font-family: Tahoma, Arial, sans-serif; font-size: 12px; line-height: normal;"><br />Description: &nbsp; &nbsp; </span><span style="font-family: Tahoma, Arial, sans-serif; font-size: 10pt; line-height: normal;">The specified HTTP method is not allowed for the requested resource.<br /><br />错误原因：<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1.</span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">继承自HttpServlet的Servlet没有重写对于请求和响应的处理方法：doGet或doPost等方法；默认调用父类的doGet或doPost等方法；<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2.</span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">父类HttpServlet的doGet或doPost等方法覆盖了你重写的doGet或doPost等方法；<br /></span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff; color: #800080;">父类HttpServlet的doGet或doPost等方法的默认实现是返回状态代码为405的HTTP错误表示对于指定资源的请求方法不被允许。<br /></span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">解决方法：<br /></span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff; color: #800080;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.</span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">子类重写doGet或doPost等方法；<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.</span><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">在你扩展的Servlert中重写doGet或doPost等方法来处理请求和响应时 不要调用父类HttpServlet的doGet或doPost等方法，即去掉super.doGet(request, response)和 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super.doPost(request, response)。<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 如果子类仅仅重写的是doGet或doPost其中一个方法，而没有另一个方法，也会报405错误</span><img src ="http://www.blogjava.net/iwwenbo/aggbug/409660.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/iwwenbo/" target="_blank">若愚若怯</a> 2014-02-10 13:32 <a href="http://www.blogjava.net/iwwenbo/archive/2014/02/10/409660.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>