在servlet中创建,写文件 和在别的地方操作是一样的哦
解决方案 »
- 首先声明只要20分给!大神,你还进来吗?
- ChartDirector 中文显示问题
- 同一页面跳转的问题
- 页面的无限跳转!
- JSP怎样在Bean中取得文件的路径??恳请各位大虾帮忙,在线等候---------
- 求QQ 服务中解决局域网内部与广域网通讯时IP 问题的思路
- urlrewrite 在jboss下使用的问题
- 收藏 java 用openoffice把html转word乱码谁知道怎么解决啊
- 要将客户端上传的文件保存到另一台服务器上,怎么解决?两台服务器的操作系统不同
- 急!急!急! 如何在JSP 页面中更改SESSION ID 谢谢!!!!
- 急问,用jsp读出sql server中的ntext类型的字段出现异常。
- 阿里巴巴的静态页面是如何统计阅读数的?
public class WriteFile {
public boolean startWrite() {
String path = "";
FileWriter fw = null;
try {
//path=ClassLoader.getSystemResource(".").toString();
path = this.getClass().getResource(".").getPath();
System.out.println("path " + path);
fw = new FileWriter(path + "test.txt");
fw.write("wubai test");
fw.close();
return true;
}
catch(Exception e){
System.out.println("write file error");
e.printStackTrace();
return false;
}
}
public static void main(String[] args) {
WriteFile w = new WriteFile();
w.startWrite();
}
}在servlet中取不到路径