jsp动态生成静态页面(3)
URL _url=new URL(url);
URLConnection conn=_url.openConnection();
InputStream inputStream=conn.getInputStream();
BufferedReader buffer=new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder=new StringBuilder();
String line=null;
while((line=buffer.readLine())!=null)
{
stringBuilder.append(line);
}
String fileContent=stringBuilder.toString();
inputStream.close();
String htmlFileName=generateFileName(url);
File htmlFile=new File("DHtml/",htmlFileName);
if(!htmlFile.exists())
{
htmlFile.createNewFile();
//把fileContent写入到html文件中
FileWriter fileWriter=new FileWriter(htmlFile,true);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>