这样实现行吗,有什么缺点

04-11-04 wzw9258
各位大侠,请问这样实现行吗?有什么缺点,请指教

本人采用这样结构:jsp+servlet+delegate+session bean(无态)+dao

Servlet类:

public class rlServlet extends HttpServlet {

private Delegate delegate=null;

public void init() throws ServletException {

delegate=new Delegate();

}

public void doGet(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOException {

performtask(request,response);

}

public void doPost(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOException {

performtask(request,response);

}

public void destroy() {

System.out.println("servlet destory!");

}

private void performtask(HttpServletRequest request,HttpServletResponse response){

//调用delegate的具体的业务方法

}

}

Delegate类:

public class Delegate {

public Delegate(){

//得到Session Bean的接口

}

public Collection getData(){

//通过Session Bean调用DAO得到数据

}

}

Session Bean类:

//通过DAO接口调用具体的方法

DAO类:

//具体实现数据的查找与增加、删除等操作

JSP页面:

/rlservlet?name=value

wzw9258
2004-11-05 08:34
怎么没回答的

猜你喜欢