日期:2014-05-17  浏览次数:20654 次

[求助]servlet中2个service方法有何区别?
1.protected void service(HttpServletRequest req,HttpServletResponse resp)throws ServletException,
IOException
2.public void service(ServletRequest req,HervletResponse res)throws ServletException,IOException

------解决方案--------------------
HttpServlet继承自GenericServlet,HttpServletRequest和HttpServletResponse分别继承自ServletRequest, ServletResponse.简单的说,就是第一个方法是HttpServlet的,第二个方法是GenericServlet的,HttpServlet因为继承了GenericServlet,所以继承了这个service方法.
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.aiyiweb.com/eclipse/181756.html