日期:2014-05-17 浏览次数:20913 次
/**
* 下面的这几行代码是在struts2的Action中
* request返回字符集是UTF-8
* 文件也创建成功
* newFile定义为html文件类型
*/
File newFile = new File(subFilePath + File.separator
+ this.getFileName(subFile) + ".html");
System.out.println("字符集-------->"+request.getCharacterEncoding());
System.out.println(context); //这里也可以正常显示中文
newFile.createNewFile();
osw.write(context);
osw.close();
logger.info("新建文件成功");