BaseServlet.java.svn-base
资源名称:cindyblog.rar [点击查看]
上传用户:cdpainuo
上传日期:2022-07-12
资源大小:5257k
文件大小:1k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.appspot.cindyblog.servlet;
- import java.io.IOException;
- import javax.persistence.EntityManager;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import com.appspot.cindyblog.service.AdminService;
- import com.appspot.cindyblog.service.BaseService;
- import com.appspot.cindyblog.service.BlogService;
- import com.appspot.cindyblog.util.Singleton;
- public abstract class BaseServlet extends HttpServlet{
- BaseService cbs = null;
- BlogService bs = null;
- AdminService as = null;
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- }
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- this.doGet(request, response);
- }
- protected BlogService getBlogService(){
- return (BlogService) Singleton.getInstance("com.appspot.cindyblog.service.BlogService");
- }
- protected AdminService getAdminService(){
- return (AdminService) Singleton.getInstance("com.appspot.cindyblog.service.AdminService");
- }
- protected void closeEntityManager(EntityManager em){
- if(em.isOpen()){
- em.close();
- }
- em = null;
- }
- }