你的服务器可以拿到绝对路径.
如tomcat,你设置webapp启动时就运行一个servlet,使用
----------
ServletConfig config = getServletConfig();
ServletContext application = config.getServletContext();String root = application.getRealPath("/").replaceAll("\\\\", "/");
----------
root设定为全局静态变量.接下来,你可以在其他地方使用root再加上子目录名称做i/o操作.
如tomcat,你设置webapp启动时就运行一个servlet,使用
----------
ServletConfig config = getServletConfig();
ServletContext application = config.getServletContext();String root = application.getRealPath("/").replaceAll("\\\\", "/");
----------
root设定为全局静态变量.接下来,你可以在其他地方使用root再加上子目录名称做i/o操作.
解决方案 »
- lomboz下找不到database explorer,无法在eclipse下浏览数据库(我用的是oracle)的内容.
- 关于SSI的整合开发
- 关于java中的Result对象
- SSH项目开发诡异问题!
- 灵异路径
- hibernate事务管理
- 一个关于tomcat端口问题,不是8080,而是8000
- Struts2.0中Tiles框架使用(我想使index页面根据用户选中某一模板文件来动态的生成index页面?请问该怎么解决)
- tomcat向weblogic移植中的中文乱码问题
- weblogic的问题
- 谁能给一个带smtp验证的javamail发邮件的例子
- EnterpriseBean和EntityBean区别
表示当前目录,其它相对目录可以用../../filePath