這樣實現行嗎,有什麼缺點

wzw9258發表於2004-11-04
各位大俠,請問這樣實現行嗎?有什麼缺點,請指教
本人採用這樣結構: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

相關文章