例: public class TextHttpServlet extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
super.doGet(req, res); //1
// ....
}
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
super.doPost(req, res);//2
// ...
}
}
如果光写1,就报一个message:HTTP method GET is not supported by this URL
如果光写2,就报一个message:HTTP method POST is not supported by this URL
两个都写,就报一个异常:java.lang.IllegalStateException本人初学者,用eclipse自动生成代码。不小心没把那个去了,让我调了半小时。最后才知道这个问题,但不知道为什么会这样。请各位大牛解答下~~~
这个问题还真是不好调试,尤其是1,2.因为他不报异常
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
super.doGet(req, res); //1
// ....
}
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{
super.doPost(req, res);//2
// ...
}
}
如果光写1,就报一个message:HTTP method GET is not supported by this URL
如果光写2,就报一个message:HTTP method POST is not supported by this URL
两个都写,就报一个异常:java.lang.IllegalStateException本人初学者,用eclipse自动生成代码。不小心没把那个去了,让我调了半小时。最后才知道这个问题,但不知道为什么会这样。请各位大牛解答下~~~
这个问题还真是不好调试,尤其是1,2.因为他不报异常
解决方案 »
- javaee项目中日志表的设计
- 关于servlet在web.xml文件中的出现的*.do,求指点
- 怎么在后台改变前台页面的样式
- 关于%转码的问题
- 请教一个MVC中的关于structs框架的入门练习的问题:
- struts用validator框架遇到的问题,动态form可以验证,静态的无法验证
- java生成XML问题
- 求 基于WEBLOGIC的JNDI的链接池源代码
- 超难问题!也是最常见的问题!著名的异常:java.net.SocketException: Connection reset by peer: socket write error,难道不能避免吗?
- 请问如何屏蔽IE工具栏中的后退和前进按钮?
- poi插入图片的奇怪问题
- 怎么让别人远程访问自己部署到tomcat的工程?
这个信息就是super类中所实现的啊,默认就是打印这样的语句
javax.servlet.http
Class HttpServlet不是抽象类