servletContext.getRealPath(String)作用(转)

getRealPath  方法是获取当前项目的绝对磁盘路径

servletContext域对象;

servletContext.getRealPath("");   -->列: D:\apache-tomcat-7.0.52\项目名

servletContext.getRealPath("/");   -->列: D:\apache-tomcat-7.0.52\项目名\

servletContext.getRealPath("/文件名");   -->列: D:\apache-tomcat-7.0.52\项目名\文件名

转:https://blog.csdn.net/weixin_41550207/article/details/79769617

posted @ 2020-12-26 18:24  快走中的擦边球  阅读(196)  评论(0编辑  收藏  举报