首先是一个模板文件template.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN "
"http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=utf-8 ">
<title> 无标题文档 </title>
</head>
<body>
<body>
<table width= "500 " border= "0 " align= "center " cellpadding= "0 " cellspacing= "2 ">
<tr>
<td align= "center "> ###title### </td>
</tr>
<tr>
<td align= "center "> author:###author### </td>
</tr>
<tr>
<td> ###content###
</td>
</tr>
</table>
</body>
</html>
这个是自己写的一个JAVA类:
package DB;
import java.io.*;
import java.util.*;
public class AutoCreate {
// private String title= null;
// private String content= null;
// private String editer= null;
private String filePath = null;
public AutoCreate()
{
}
public String CreateFile(String path, String title, String content, String editer)
{
filePath = path + "html/template.htm ";
String templateContent= " ";
try{
FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件
int lenght = fileinputstream.available();