basicservlet.java
来自「java的一系列产品中包括jsme,jmse,j2ee,本文件提供j2ee实现的」· Java 代码 · 共 33 行
JAVA
33 行
/**
* this servlet is the super servlet,to offer common methods to the sub_servlets
* all the sub_servlets need to implement the abstract method:doExecute().
**/
public abstract class BasicServlet extends HttpServlet
{
private static final String CONTENT_TYPE = "text/html; charset=Shift_JIS";
public void init(ServletConfig config) throws ServletException{
super.init(config);
......//do other initialize
}
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException{
doExecute(request,response);
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException{
doExecute(request,response);
}
public String getContentType(){
return CONTENT_TYPE;
}
/**
* Public abstract Method:need be implement by subclass
**/
public abstract void doExecute(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?