jsp 静态化

/

import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

/**
 * 将信息发布为静态页面
 * 
 * @author xchun
 * 
 */

public class Jsp2Html {
 /**
  * 将信息转化为静态html
  * 
  * @param sSourceUrl
  *            动态信息访问URL
  * @param sDestDir
  *            存储为静态文件的目录
  * @param sHtmlFile
  *            生成的静态文件名,可以按信息的唯一ID+.html命名
  * @throws IOException
  */
 
 public static void convert2Html(String sSourceUrl, String sDestDir,
   String sHtmlFile) throws IOException {
  int HttpResult;
  URL url = new URL(sSourceUrl);
  
  URLConnection urlconn = url.openConnection();
  urlconn.connect();
  HttpURLConnection httpconn = (HttpURLConnection) urlconn;
  HttpResult = httpconn.getResponseCode();
  
  if (HttpResult != HttpURLConnection.HTTP_OK) {
  } else {
   BufferedReader in = new BufferedReader(new InputStreamReader(urlconn.getInputStream(),"UTF-8")); 

   String inputLine;
   if (!sDestDir.endsWith("/"))
    sDestDir += "/";
   OutputStreamWriter fout = new OutputStreamWriter(new FileOutputStream(sDestDir + sHtmlFile),"utf-8"); //设置输出文件的编码。 
   
   while ((inputLine = in.readLine()) != null) {
    fout.write(inputLine);

   }
   in.close();
   fout.close();

  }

 }

 public static void main(String[] args) throws IOException {

  for(int i=1;i<10;i++)
  convert2Html(
    "http://blog.94fzb.com:8080/post/page/"+i,"F:",i+".html");

 }

}

Reproduced please indicate the author and the source, and error a link to this page.
text link: //xiaochun.zrlog.com/147.html