当前位置: 技术问答>java相关
一个关于 HttpServlet 的问题
来源: 互联网 发布时间:2015-06-22
本文导语: 我不知道为什么提示出错 "BaseHttpServlet.java": Error #: 454 : class mfc.BaseHttpServlet should be declared abstract; it does not define method processRequestType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class mfc....
我不知道为什么提示出错
"BaseHttpServlet.java": Error #: 454 : class mfc.BaseHttpServlet should be declared abstract; it does not define method processRequestType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class mfc.BaseHttpServlet at line 8, column 8
我的代码如下
public class BaseHttpServlet extends HttpServlet
implements Constants{
private static String cName="BaseHttpServlet";
abstract public void init() throws ServletException;
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException{
doPost(request,response);
}
abstract public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException;
abstract public void processRequestType(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException;
public void redirectToResource(HttpServletRequest request,
HttpServletResponse response,
String resourceName)
throws ServletException,IOException{
....
}
}
"BaseHttpServlet.java": Error #: 454 : class mfc.BaseHttpServlet should be declared abstract; it does not define method processRequestType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class mfc.BaseHttpServlet at line 8, column 8
我的代码如下
public class BaseHttpServlet extends HttpServlet
implements Constants{
private static String cName="BaseHttpServlet";
abstract public void init() throws ServletException;
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException{
doPost(request,response);
}
abstract public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException;
abstract public void processRequestType(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException;
public void redirectToResource(HttpServletRequest request,
HttpServletResponse response,
String resourceName)
throws ServletException,IOException{
....
}
}
|
如果你的类里面的方法被声明成为abstract那么这个类必须被声明为abstract
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。