当前位置: 代码迷 >> Java Web开发 >> 怎么在servlet中使网址不转义
  详细解决方案

怎么在servlet中使网址不转义

热度:127   发布时间:2016-04-16 22:18:16.0
如何在servlet中使网址不转义
String path="http://localhost:8080/mytest/paper/";
File file = new File("http://localhost:8080/mytest/paper/"+datetime+".txt");
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(context);
fileWriter.close();

@"http://localhost:8080/mytest/paper/"无效

------解决方案--------------------
File file = new File(request.getSession().getServletContext().getRealPath("/"+datetime+".txt"));
这里需要一个物理文件,
  相关解决方案