第一个servlet小程序可能遇到的问题

1.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.

继承自HttpServlet的Servlet没有重写对于请求和响应的处理方法:doGet或doPost等方法;默认调用父类的doGet或doPost等方法;

父类HttpServlet的doGet或doPost等方法覆盖了你重写的doGet或doPost等方法;

解决方法,重写doGet或doPost等方法, 重写的doGet或doPost等方法去掉super.doGet()或super.doPost()


2.HTTP Status 500 - Error instantiating servlet class

type Exception report

message Error instantiating servlet class Three

description The server encountered an internal error that prevented it from fulfilling this request.

再刷新就会

HTTP Status 404 -

type Status report

message

description The requested resource is not available.

原因是web.xml文件中

<servlet-class>(类)</servlet-class> 类的引用不正确

这里的类引用要包含类所在的包如:test类属于test包,这里就应该写test.test





评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值