日期:2014-05-20  浏览次数:20695 次

请问Servlet为什么这么部署错误啊 请高手给看看
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>HttpServletTest</servlet-name>
<servlet-class>cn.jbit.servlet.HttpServletTest</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HttpServletTest</servlet-name>
<url-pattern>/HttpServletTest</url-pattern>
</servlet-mapping>
</web-app>

我的HttpServletTest类的包名在src下的cn.jbit.servlet 为什么这么配置路劲错误啊 给我报这个错误

HTTP Status 405 - HTTP method GET is not supported by this URL

--------------------------------------------

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).


--------------------------------------------


------解决方案--------------------
你的servlet重写的是什么方法,是dopost还是doget,

HTTP method GET is not supported by this URL
注意错误提示,是 method GET
看看你页面表单的提交方法是什么?
不然就是servlet里面重写的方法不对。
要么就重写service()方法,最保险。