while(rs.next()){
String id=rs.getString("id");
String title=rs.getString("title");
String Content=rs.getString("content");
String Adddate=rs.getString("AddDate");
String click=rs.getString("click");
String keyWord=rs.getString("keyword");
String tempContent=null;
String FileName=rs.getString("id").toString()+rs.getString("addDate").replaceAll(".", "").replaceAll(":", "").replaceAll(" ","").replaceAll("-","")+".html";
StringBuffer sb=new StringBuffer("");
String ln="";

//读取模板,替换相应内容
File file=new File(tempPh);
try {
if(file.exists()){
//读取文件
BufferedReader bf=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
while((ln=bf.readLine())!=null){
sb.append(ln);
}
//写入文件
File nf=new File(filePh+"/"+FileName);
nf.createNewFile();
FileWriter fw=new FileWriter(nf);
fw.write(sb.toString().replaceAll("{title}", title).replaceAll("{content}", Content).replaceAll("{adddate}", Adddate).replaceAll("{click}",click).replaceAll("{author}","Admin").replaceAll("{id}", id).replaceAll("{keyword}",keyWord));
fw.flush();
fw.close();

 
}
} catch (FileNotFoundException e) {

e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}