日期:2014-05-17 浏览次数:20922 次
  JSONArray jsonArray2 = JSONArray.fromObject(Hotels);
             String path = System.getProperty("user.dir").replace("\\", "/") +"/../webapps/ChinaTravelServiceZJ";
            path =path+"/data.txt";
            
            File file = new File(path);
            Writer outTxt = null;
            try {
                outTxt = new OutputStreamWriter(new FileOutputStream(file,false), "UTF-8");
            } catch (UnsupportedEncodingException e1) {
                e1.printStackTrace();
            }
                    System.out.println(jsonArray2.toString());
                    System.out.println(path);
                    outTxt.write(jsonArray2.toString());
                    outTxt.close();