求助:servlet运行时出现的问题 HTTP method GET is not supported by this URL

itsoft2006 2007-04-04 12:12:14
各位兄弟姐妹,小弟在调试JSP的时候遇到一个问题:
servlet运行时出现的问题 HTTP method GET is not supported by this URL
昨晚调了一晚都搞不定,代码如下:
package ch07;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class SampleServlet1 extends HttpServlet {
public void doGet(HttpServlet request,HttpServletResponse response)
throws ServletException,IOException{
response.setContentType("text/html;charset=GB2312");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>Servlet</title></head>");
out.println("<body>");
out.println("大家好");
out.println("</body>");
out.println("</html>");
out.close();
}
}
...全文
175 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ChDw 2007-04-04
  • 打赏
  • 举报
回复
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{


你参数定义错误了,结果你的Servlet并没有覆盖父类的方法
aimer311 2007-04-04
  • 打赏
  • 举报
回复
doGet()改成service()

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧