将字段写入到文件中

将字段写入文件中,保存为UTF-8格式

String path=request.getRealPath("");//获得项目路径
String str="";//要写入的字符
FileOutputStream fos = new FileOutputStream(path+"/resources/temp/industry.js");
Writer writer = new OutputStreamWriter(fos, "UTF-8");
str="document.writeln(\"<div class=current id=''></div>\");";
writer.write(str);
writer.close();
fos.close();

   

你可能感兴趣的:(文件)