当前位置: 代码迷 >> Java Web开发 >> java 如何自动生成txt文件
  详细解决方案

java 如何自动生成txt文件

热度:8407   发布时间:2013-02-25 21:16:00.0
java 怎么自动生成txt文件
HttpClient httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager());

try {

//创建httpget.
String url[]={"http://www.sohu.com","http://www.baidu.com","http://www.sina.com"};


HttpGet httpget = null;
HttpResponse response = null;

for(int i = 0; i<url.length; i++){

httpget = new HttpGet(url[i]);

System.out.println("executing request " + httpget.getURI());

response = httpclient.execute(httpget);

System.out.println("响应状态:" + response.getStatusLine());
 
System.out.println("------------------------------------");
 

}finally {
 
httpclient.getConnectionManager().shutdown();
}


把输出的内容自动生成一个txt文件,我是新手,最好有源码,谢谢了!!

------解决方案--------------------------------------------------------
你这个像日志输出 你百度一下 log4j 看看别人写的例子
  相关解决方案