waysun一路阳光

不轻易服输,不轻言放弃.--心是梦的舞台,心有多大,舞台有多大。踏踏实实做事,认认真真做人。

  BlogJava :: 首页 :: 新随笔 :: 联系 ::  :: 管理 ::
  167 随笔 :: 1 文章 :: 64 评论 :: 0 Trackbacks

1.ExcelManagerFactory
package com.factory;

public class ExcelManagerFactory {
   private static String key = "key";
   private ExcelManagerFactory() {
   }
  
   private static ExcelManagerIf instance = null;
   public static ExcelManagerIf getInstance(){
    if(instance == null){
             synchronized(key){
                 if(instance == null){
                     instance = new ExcelManagerImpl();
                 }
             }
         }
         return instance;
   }
}

2.声明一个接口

package com.factory;

import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import com.gpdi.orm.object.ScoreRecordDetail;

public interface ExcelManagerIf {
 
 public boolean export(HttpServletResponse response, List<ScoreRecordDetail> list,LinkedHashMap hashMap);
 /********************************************************************************************************/
 public boolean export1(HttpServletResponse response,List list,LinkedHashMap hashMap);
 /********************************************************************************************************/

 

}
3.实现接口的类


package com.factory;

import java.io.IOException;

 


public class ExcelManagerImpl implements ExcelManagerIf
{
         public boolean export1(HttpServletResponse response, List list,LinkedHashMap hashMap)
         {
                    //实现具体功能的代码实现
         }
}
4.调用
  HttpServletResponse response=null;
  LinkedHashMap hm = new LinkedHashMap();
  List list = Object.getList();
   ExcelManagerIf eem = ExcelManagerFactory.getInstance();
   /******************************************************************/
   eem.export(response, list,hm);

 

posted on 2009-02-22 19:22 weesun一米阳光 阅读(467) 评论(0)  编辑  收藏 所属分类: 总结备用cnweblog/nm1504

只有注册用户登录后才能发表评论。


网站导航: