我给的这个架构可以代替ssh的架构进行项目的开发
common中放的是一些公用类
dao中放的是一些对数据的处理
entity其实也就是javabean
service中放的是一些抽象类,简单来说抽象类就是有一些接口,所谓的接口就是只有"方法名,加上一个分号".如下
1 package com.ll.www.mis.service; 2 3 import java.io.IOException; 4 import java.util.List; 5 6 import javax.servlet.ServletException; 7 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletResponse; 9 10 public interface IOrderService { 11 12 public void SelectAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; 13 14 public void SelectByPar(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; 15 16 public void Save(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; 17 18 public void Update(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; 19 20 public void Delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; 21 22 }
service.imp实现这些接口
servlet类似于ssh中是struts的action。
感觉按照这个架构进行代码的封装出来的效果也不错。
时间: 2024-11-08 20:13:40