在web中读取文件的自用程序

	
	public String getCodeDataConfig(){
		List list = new ArrayList();
		String lookup_type = request().getParameter("lookup_type");
		String condition = request().getParameter("conditions");
		String celId = request().getParameter("celId");
		String dir = ServletActionContext.getServletContext().getRealPath("/");
		System.out.println("dir="+dir);
		try {
			
			FileReader fr = new FileReader(dir + "/WEB-INF/classes/com/dvnchina/boss/util/cache/CODE_DATA_CONFIG.properties");
			BufferedReader buf = new BufferedReader(fr);
			String line = null;
			while((line = buf.readLine()) != null){
			//	System.out.println(line);
				list.add(line);
			}
			buf.close();
			fr.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println(list.size());
		List resultList1 = new ArrayList();//存储bs_tb_lookup_cde表中的数据
		List resultList2 = new ArrayList();//存储有BS_TB表中对应的数据
		for(int i=0;i<list.size();i++){
			String str = (String)list.get(i);
			String strs[] = str.split("=");
			String s1 = strs[0].trim();
			String s2 = strs[1].trim();
	
			if(s1.equals(lookup_type)) {
				if(s2.indexOf("BS_TB") != -1){
					resultList2.add(s2);
				}else {
					resultList1.add(s2);
				}
				break;
			}
		}
		
		String sql1 = "select l.lookup_cde,l.cde_dscr from bs_tb_lookup_cde l where l.lookup_type ="+"'"+resultList1.get(0).toString().trim() +"'";
		StringBuffer sql = new StringBuffer(sql1);
		sql.append(" ");
		sql.append("and 1=1");
		if( condition != null && condition.length()>0){
			sql.append("and");
			sql.append(" ");
			sql.append(condition);	
			
		}
		List result = SpringJdbcTemplateUtil.getInstance().querySpecifiedResultBySql(sql.toString());	
		System.out.println(sql.toString());
		result.add(result.size(), celId);
		return super.getMacroReturnPage(result);
	}
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值