我创建一个Servlet,然后在web.xml文件中也配置没问题.但是为什么如果不重写doGet方法,就根本没有办法调用呢?

解决方案 »

  1.   

    你应该是采用get方式提交的吧
      

  2.   

    不是的,我直接在浏览器里输入地址访问 的...额...差不多也是GET方式吧..记得以前不用这样子的啊?
      

  3.   

    如果我不extends HttpServlet 只写一个class,然后写个main函数,这样也不行..不过错误提示什么 class *** is not a servlet ?!~?
      

  4.   

    只是一点儿疑问啊...
    在重写的doGet方法里添加一句:
    super.doGet(req, resp);也会出现HTTP404错误..
      

  5.   

    o(∩_∩)o...哈哈,
    http不认识你的class函数,HttpServlet 则不同
      

  6.   

    哦..这样子啊..可是.. 我在MyEclipse里面新建一个class,然后继承HttpServlet, 再然后,什么都不写,配好web.xml文件,这也算是个servlet吧?http应该认识吧?但是它就是报错,http404错误..
      

  7.   

    额...原来我搞错了..我加了一个main()函数..用http调用就提示HTTP Status 405 - HTTP method GET is not supported by this URL--------------------------------------------------------------------------------type Status reportmessage HTTP method GET is not supported by this URLdescription The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
    --------------------------------------------------------------------------------Apache Tomcat/6.0.13